home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / HELPPC.ZIP / TABLES.TXT < prev   
Text File  |  1991-04-15  |  91KB  |  2,553 lines

  1. @Tables and Formats used by DOS & BIOS
  2. :backup headers
  3. ^DOS BACKUP Control Information
  4.  
  5. %    BACKUPID.@@@ Format
  6.  
  7. %     Offset Size        Description
  8.     00   byte   Disk sequence flag:
  9.             00  indicates disk is not the last backup diskette
  10.             FF  indicates disk is the last backup diskette
  11.     01   word   Floppy disk sequence number (Intel format)
  12.     03   word   Backup year, four digits (Intel format)
  13.     05   byte   Day of month (1-31)
  14.     06   byte   Month of year (1-12)
  15.     07   dword  System time if /T was specified (see ~FILE ATTRIBUTES~)
  16.     0B 117bytes Unused
  17.  
  18.  
  19. %    Backup File Header
  20.  
  21. %     Offset Size        Description
  22.     00   byte   Disk sequence flag:
  23.             00  indicates disk is not the last backup diskette
  24.             FF  indicates disk is the last backup diskette
  25.     01   byte   Floppy disk sequence number
  26.     02  3bytes  Unused
  27.     05 64bytes  Full pathname (without drive designator)
  28.     45 14bytes  Unused
  29.     53   byte   Length of file path name at offset 05 plus 1
  30.     54 44Bytes  Unused
  31. :BIOS Parameter Block:BPB
  32. ^BPB - BIOS Parameter Block
  33.  
  34. %     Offset Size        Description
  35.  
  36.     00   word    sector size in bytes
  37.     02   byte    sectors per cluster (allocation unit size)
  38.     03   word    number of reserved sectors
  39.     05   byte    number of FATs on disk
  40.     06   word    number of root directory entries (directory size)
  41.     08   word    number of total sectors; if partition > 32Mb then set
  42.             to zero and dword at 15h contains the actual count
  43.     0A   byte    media descriptor byte  (see ~MEDIA DESCRIPTOR~)
  44.     0B   word    sectors per ~FAT~
  45.  
  46. %    Additional/different fields for DOS 3.0+
  47.     0D   word    sectors per track
  48.     0F   word    number of heads
  49.     11   word    number of hidden sectors
  50.     15 11bytes    reserved
  51.  
  52. %    Additional/different fields for DOS 4.0+
  53.     15   dword    number of total sectors if offset 8 is zero
  54.     19  6bytes    reserved
  55.     1F   word    number of cylinders
  56.     21   byte    device type
  57.     22   word    device attributes
  58.  
  59.     - located in the boot sector at offset 0Bh
  60.  
  61.     - see    ~BOOT SECTOR~
  62. :Batch Control Block:BCB
  63. ^BCB - Batch Control Block (undocumented)
  64.  
  65. ^DOS 2.x thru DOS 3.2  BCB Format
  66.  
  67. %     Offset Size           Description
  68.  
  69.     00   byte    unknown
  70.     01   word    if non-zero; segment of control block for active FOR
  71.     03   byte    type of batch command
  72.                 0 - normal batch command
  73.                 1 - FOR-loop active
  74.     04   dword    offset of next command to execute in batch file
  75.     07   word    offset of variable %0 (batch file name)
  76.     09  9 words    offset of %N batch file parameters, 0FFFFh indicates
  77.             parameter is null
  78.     1C   nbytes    null terminated path and filename of the current
  79.             batch file immediately followed by command line
  80.             parameters.  Each parameter %0-%9 plus a CR is
  81.             appended and resulting string is null terminated.
  82.  
  83.  
  84. ^DOS 3.3  BCB Format
  85.  
  86. %     Offset Size           Description
  87.  
  88.     00   byte    unknown
  89.     01   byte    global echo switch, if exec'd by batch CALL-command
  90.                 1 - turn ECHO ON on return to calling batch file
  91.                 0 - turn ECHO OFF on return to calling batch file
  92.     02   word    batch file BCD segment if executed via CALL
  93.                 if zero; batch file was called from command line
  94.                 if non-zero; batch file executed via CALL-command
  95.     04   word    if non-zero; segment of control block for active FOR
  96.     06   byte    type of batch command
  97.                 0 - normal batch command
  98.                 1 - FOR-loop active
  99.     07   dword    offset of next command to execute in batch file
  100.     0B   word    offset of variable %0 (batch file name)
  101.     0D  9words    offset of %N batch file parameters, 0FFFFh indicates
  102.             parameter is null
  103.     1F  nbytes    null terminated path and filename of the current
  104.             batch file immediately followed by command line
  105.             parameters.  Each parameter %0-%9 plus a CR is
  106.             appended and resulting string is null terminated.
  107.  
  108.  
  109.     - BCB length is variable and depends on the size and count of the
  110.       parameters and fully qualified batch file name
  111.     - the MCB for a BCB has a process Id of the transient portion of
  112.       the latest COMMAND.COM
  113.     - offsets displayed are relative to the BCB segment
  114.     - SHIFT command changes the offsets of the parameters in the table
  115.       at the offsets 0B0h thru 1Ch
  116.     - BCB  of DOS 3.3 is the  same as earlier versions except 3 bytes
  117.       were added after offset 0
  118.     - to find a BCB, locate the first block in the MCB chain belonging
  119.       to COMMAND.COM (the second allocated block always belongs to
  120.       COMMAND.COM).  Then scan the ~MCB~ chain for a 64 byte block with
  121.       the same owner ID as COMMAND.COM).  This will be the BCB.
  122. :BIOS Data Area:BDA:BIOS memory:memory map
  123. ^BDA - BIOS Data Area - PC Memory Map
  124.  
  125. %    Address Size       Description
  126.  
  127.     00:00 256dwords Interrupt vector table
  128.     30:00 256bytes    Stack area used during post and bootstrap
  129.     40:00    word    COM1 port address
  130.     40:02    word    COM2 port address
  131.     40:04    word    COM3 port address
  132.     40:06    word    COM4 port address
  133.     40:08    word    LPT1 port address
  134.     40:0A    word    LPT2 port address
  135.     40:0C    word    LPT3 port address
  136.     40:0E    word    LPT4 port address (except PS/2)
  137.             Extended BIOS Data Area segment (PS/2, see ~EBDA~)
  138.     40:10  2 bytes    Equipment list flags (see ~INT 11~)
  139.  
  140.         │7│6│5│4│3│2│1│0│ 40:10 (value in INT 11 register AL)
  141.          │ │ │ │ │ │ │ └─ IPL diskette installed
  142.          │ │ │ │ │ │ └── math coprocessor
  143.          │ │ │ │ ├─┼─── old PC system board RAM < 256K
  144.          │ │ │ │ │ └── pointing device installed (PS/2)
  145.          │ │ │ │ └─── not used on PS/2
  146.          │ │ └─┴──── initial video mode
  147.          └─┴─────── # of diskette drives, less 1
  148.  
  149.         │7│6│5│4│3│2│1│0│ 40:11  (value in INT 11 register AH)
  150.          │ │ │ │ │ │ │ └─ 0 if DMA installed
  151.          │ │ │ │ └─┴─┴── number of serial ports
  152.          │ │ │ └─────── game adapter
  153.          │ │ └──────── not used, internal modem (PS/2)
  154.          └─┴───────── number of printer ports
  155.  
  156.     40:12    byte    PCjr: infrared keyboard link error count
  157.     40:13    word    Memory size in Kbytes  (see ~INT 12~)
  158.     40:15    byte    Reserved
  159.     40:16    byte    PS/2 BIOS control flags
  160.     40:17    byte    Keyboard flag byte 0 (see ~KB FLAGS~)
  161.  
  162.         │7│6│5│4│3│2│1│0│ keyboard flag byte 0
  163.          │ │ │ │ │ │ │ └─── right shift key depressed
  164.          │ │ │ │ │ │ └──── left shift key depressed
  165.          │ │ │ │ │ └───── CTRL key depressed
  166.          │ │ │ │ └────── ALT key depressed
  167.          │ │ │ └─────── scroll-lock is active
  168.          │ │ └──────── num-lock is active
  169.          │ └───────── caps-lock is active
  170.          └────────── insert is active
  171.  
  172.     40:18    byte    Keyboard flag byte 1 (see ~KB FLAGS~)
  173.  
  174.         │7│6│5│4│3│2│1│0│ keyboard flag byte
  175.          │ │ │ │ │ │ │ └─── left CTRL key depressed
  176.          │ │ │ │ │ │ └──── left ALT key depressed
  177.          │ │ │ │ │ └───── system key depressed and held
  178.          │ │ │ │ └────── suspend key has been toggled
  179.          │ │ │ └─────── scroll lock key is depressed
  180.          │ │ └──────── num-lock key is depressed
  181.          │ └───────── caps-lock key is depressed
  182.          └────────── insert key is depressed
  183.  
  184.     40:19    byte    Storage for alternate keypad entry
  185.     40:1A    word    Offset from 40:00 to keyboard buffer head
  186.     40:1C    word    Offset from 40:00 to keyboard buffer tail
  187.     40:1E  32bytes    Keyboard buffer (circular queue buffer)
  188.     40:3E    byte    Drive recalibration status
  189.  
  190.         │7│6│5│4│3│2│1│0│ drive recalibration status
  191.          │ │ │ │ │ │ │ └── 1=recalibrate drive 0
  192.          │ │ │ │ │ │ └─── 1=recalibrate drive 1
  193.          │ │ │ │ │ └──── 1=recalibrate drive 2
  194.          │ │ │ │ └───── 1=recalibrate drive 3
  195.          │ └─┴─┴────── unused
  196.          └─────────── 1=working interrupt flag
  197.  
  198.     40:3F    byte    Diskette motor status
  199.  
  200.         │7│6│5│4│3│2│1│0│ diskette motor status
  201.          │ │ │ │ │ │ │ └── 1=drive 0 motor on
  202.          │ │ │ │ │ │ └─── 1=drive 1 motor on
  203.          │ │ │ │ │ └──── 1=drive 2 motor on
  204.          │ │ │ │ └───── 1=drive 3 motor on
  205.          │ └─┴─┴────── unused
  206.          └─────────── 1=write operation
  207.  
  208.     40:40    byte    Motor shutoff counter (decremented by ~INT 8~)
  209.     40:41    byte    Status of last diskette operation (see ~INT 13,1~)
  210.  
  211.         │7│6│5│4│3│2│1│0│ status of last diskette operation
  212.          │ │ │ │ │ │ │ └─── invalid diskette command
  213.          │ │ │ │ │ │ └──── diskette address mark not found
  214.          │ │ │ │ │ └───── sector not found
  215.          │ │ │ │ └────── diskette DMA error
  216.          │ │ │ └─────── CRC check / data error
  217.          │ │ └──────── diskette controller failure
  218.          │ └───────── seek to track failed
  219.          └────────── diskette time-out
  220.  
  221.     40:42  7 bytes    NEC diskette controller status (see ~FDC~)
  222.     40:49    byte    Current video mode  (see ~VIDEO MODE~)
  223.     40:4A    word    Number of screen columns
  224.     40:4C    word    Size of current video regen buffer in bytes
  225.     40:4E    word    Offset of current video page in video regen buffer
  226.     40:50  8 words    Cursor position of pages 1-8, high order byte=row
  227.             low order byte=column; changing this data isn't
  228.             reflected immediately on the display
  229.     40:60    byte    Cursor ending (bottom) scan line (don't modify)
  230.     40:61    byte    Cursor starting (top) scan line (don't modify)
  231.     40:62    byte    Active display page number
  232.     40:63    word    Base port address for active ~6845~ CRT controller
  233.             3B4h = mono, 3D4h = color
  234.     40:65    byte    6845 CRT mode control register value (port 3x8h)
  235.             EGA/VGA values emulate those of the MDA/CGA
  236.     40:66    byte    CGA current color palette mask setting (port 3d9h)
  237.             EGA and VGA values emulate the CGA
  238.     40:67    dword    CS:IP for 286 return from protected mode
  239.         dword    Temp storage for SS:SP during shutdown
  240.         dword    Day counter on all products after AT
  241.         dword    PS/2 Pointer to reset code with memory preserved
  242.         5 bytes    Cassette tape control (before AT)
  243.     40:6C    dword    Daily timer counter, equal to zero at midnight;
  244.             incremented by INT 8; read/set by ~INT 1A~
  245.     40:70    byte    Clock rollover flag, set when 40:6C exceeds 24hrs
  246.     40:71    byte    BIOS break flag, bit 7 is set if ~Ctrl-Break~ was
  247.             *ever* hit; set by ~INT 9~
  248.     40:72    word    Soft reset flag via Ctl-Alt-Del or JMP FFFF:0
  249.  
  250.             1234h  Bypass memory tests & CRT initialization
  251.             4321h  Preserve memory
  252.             5678h  System suspend
  253.             9ABCh  Manufacturer test
  254.             ABCDh  Convertible POST loop
  255.             ????h  many other values are used during POST
  256.  
  257.     40:74    byte    Status of last hard disk operation (see ~INT 13,1~)
  258.     40:75    byte    Number of hard disks attached
  259.     40:76    byte    XT fixed disk drive control byte
  260.     40:77    byte    Port offset to current fixed disk adapter
  261.     40:78  4 bytes    Time-Out value for LPT1,LPT2,LPT3(,LPT4 except PS/2)
  262.     40:7C  4 bytes    Time-Out value for COM1,COM2,COM3,COM4
  263.     40:80    word    Keyboard buffer start offset (seg=40h,BIOS 10-27-82)
  264.     40:82    word    Keyboard buffer end offset (seg=40h,BIOS 10-27-82)
  265.     40:84    byte    Rows on the screen (less 1, EGA+)
  266.     40:85    word    Point height of character matrix (EGA+)
  267.         byte    PCjr: character to be repeated if the typematic
  268.             repeat key takes effect
  269.     40:86    byte    PCjr: initial delay before repeat key action begins
  270.     40:87    byte    PCjr: current Fn function key number
  271.         byte    Video mode options (EGA+)
  272.  
  273.         │7│6│5│4│3│2│1│0│ Video mode options (EGA+)
  274.          │ │ │ │ │ │ │ └── 1=alphanumeric cursor emulation enabled
  275.          │ │ │ │ │ │ └─── 1=video subsystem attached to monochrome
  276.          │ │ │ │ │ └──── reserved
  277.          │ │ │ │ └───── 1=video subsystem is inactive
  278.          │ │ │ └────── reserved
  279.          │ └─┴─────── video RAM  00-64K  10-192K  01-128K  11-256K
  280.          └────────── video mode number passed to ~INT 10~, function 0
  281.  
  282.     40:88    byte    PCjr: third keyboard status byte
  283.             EGA feature bit switches, emulated on VGA
  284.  
  285.         │7│6│5│4│3│2│1│0│ EGA feature bit switches (EGA+)
  286.          │ │ │ │ │ │ │ └── EGA SW1 config (1=off)
  287.          │ │ │ │ │ │ └─── EGA SW2 config (1=off)
  288.          │ │ │ │ │ └──── EGA SW3 config (1=off)
  289.          │ │ │ │ └───── EGA SW4 config (1=off)
  290.          │ │ │ └────── Input FEAT0 (ISR0 bit 5) after output on FCR0
  291.          │ │ └─────── Input FEAT0 (ISR0 bit 6) after output on FCR0
  292.          │ └──────── Input FEAT1 (ISR0 bit 5) after output on FCR1
  293.          └───────── Input FEAT1 (ISR0 bit 6) after output on FCR1
  294.  
  295.     40:89    byte    Video display data area (MCGA and VGA)
  296.  
  297.         │7│6│5│4│3│2│1│0│ Video display data area (MCGA and VGA)
  298.          │ │ │ │ │ │ │ └── 1=VGA is active
  299.          │ │ │ │ │ │ └─── 1=gray scale is enabled
  300.          │ │ │ │ │ └──── 1=using monochrome monitor
  301.          │ │ │ │ └───── 1=default palette loading is disabled
  302.          │ │ │ └────── see table below
  303.          │ │ └─────── reserved
  304.          │ └────────  1=display switching enabled
  305.          └───────── alphanumeric scan lines (see table below)
  306.  
  307. %          Bit7    Bit4    Scan Lines
  308.         0    0    350 line mode
  309.         0    1    400 line mode
  310.         1    0    200 line mode
  311.         1    1    reserved
  312.  
  313.     40:8A    byte    Display Combination Code (DCC) table index (EGA+)
  314.     40:8B    byte    Last diskette data rate selected
  315.  
  316.         │7│6│5│4│3│2│1│0│ last diskette data rate selected
  317.          │ │ │ │ └─┴─┴─┴─── reserved
  318.          │ │ └─┴────────── last floppy drive step rate selected
  319.          └─┴──────────── last floppy data rate selected
  320.  
  321. %        Data Rate             Step Rate
  322.         00  500K bps        00  step rate time of 0C
  323.         01  300K bps        01  step rate time of 0D
  324.         10  250K bps        10  step rate time of 0A
  325.         11  reserved        11  reserved
  326.  
  327.     40:8C    byte    Hard disk status returned by controller
  328.     40:8D    byte    Hard disk error returned by controller
  329.     40:8E    byte    Hard disk interrupt control flag(bit 7=working int)
  330.     40:8F    byte    Combination hard/floppy disk card when bit 0 set
  331.     40:90  4 bytes    Drive 0,1,2,3 media state
  332.  
  333.         │7│6│5│4│3│2│1│0│ drive media state (4 copies)
  334.          │ │ │ │ │ └─┴─┴─── drive/media state (see below)
  335.          │ │ │ │ └─────── reserved
  336.          │ │ │ └─────── 1=media/drive established
  337.          │ │ └─────── double stepping required
  338.          └─┴─────── data rate:    00=500K bps    01=300K bps
  339.                     10=250K bps    11=reserved
  340. %        Bits
  341. %        210  Drive Media State
  342.         000  360Kb diskette/360Kb drive not established
  343.         001  360Kb diskette/1.2Mb drive not established
  344.         010  1.2Mb diskette/1.2Mb drive not established
  345.         011  360Kb diskette/360Kb drive established
  346.         100  360Kb diskette/1.2Mb drive established
  347.         101  1.2Mb diskette/1.2Mb drive established
  348.         110  Reserved
  349.         111  None of the above
  350.  
  351.     40:94    byte    Track currently seeked to on drive 0
  352.     40:95    byte    Track currently seeked to on drive 1
  353.     40:96    byte    Keyboard mode/type
  354.  
  355.         │7│6│5│4│3│2│1│0│ Keyboard mode/type
  356.          │ │ │ │ │ │ │ └─── last code was the E1 hidden code
  357.          │ │ │ │ │ │ └──── last code was the E0 hidden code
  358.          │ │ │ │ │ └───── right CTRL key depressed
  359.          │ │ │ │ └────── right ALT key depressed
  360.          │ │ │ └─────── 101/102 enhanced keyboard installed
  361.          │ │ └──────── force num-lock if Rd ID & KBX
  362.          │ └───────── last char was first ID char
  363.          └────────── read ID in process
  364.  
  365.     40:97    byte    Keyboard LED flags
  366.  
  367.         │7│6│5│4│3│2│1│0│ Keyboard LED flags
  368.          │ │ │ │ │ │ │ └─── scroll lock indicator
  369.          │ │ │ │ │ │ └──── num-lock indicator
  370.          │ │ │ │ │ └───── caps-lock indicator
  371.          │ │ │ │ └────── circus system indicator
  372.          │ │ │ └─────── ACK received
  373.          │ │ └──────── re-send received flag
  374.          │ └───────── mode indicator update
  375.          └────────── keyboard transmit error flag
  376.  
  377.     40:98    dword    Pointer to user wait complete flag
  378.     40:9C    dword    User wait Time-Out value in microseconds
  379.     40:A0    byte    RTC wait function flag
  380.  
  381.         │7│6│5│4│3│2│1│0│ ~INT 15,86~ RTC wait function flag
  382.          │ │ │ │ │ │ │ └─── 1= wait pending
  383.          │ └─┴─┴─┴─┴─┴──── not used
  384.          └─────────────── 1=INT 15,86 wait time elapsed
  385.  
  386.     40:A1    byte    LANA DMA channel flags
  387.     40:A2  2 bytes    Status of LANA 0,1
  388.     40:A4    dword    Saved hard disk interrupt vector
  389.     40:A8    dword    BIOS Video Save/Override Pointer Table address
  390.             (see ~VIDEO TABLES~)
  391.     40:AC  8 bytes    Reserved
  392.     40:B4    byte    Keyboard NMI control flags (convertible)
  393.     40:B5    dword    Keyboard break pending flags (convertible)
  394.     40:B9    byte    Port 60 single byte queue (convertible)
  395.     40:BA    byte    Scan code of last key (convertible)
  396.     40:BB    byte    NMI buffer head pointer (convertible)
  397.     40:BC    byte    NMI buffer tail pointer (convertible)
  398.     40:BD  16bytes    NMI scan code buffer (convertible)
  399.     40:CE    word    Day counter (convertible and after)
  400.     40:F0  16bytes    Intra-Applications Communications Area (IBM Technical
  401.             Reference incorrectly locates this at 50:F0-50:FF)
  402.  
  403.  
  404. %    Address Size       Description     (BIOS/DOS Data Area)
  405.  
  406.     50:00    byte    Print screen status byte
  407.              00 = PrtSc not active,
  408.              01 = PrtSc in progress
  409.              FF = error
  410.     50:01  3 bytes    Used by BASIC
  411.     50:04    byte    DOS single diskette mode flag, 0=A:, 1=B:
  412.     50:05  10bytes    POST work area
  413.     50:0F    byte    BASIC shell flag; set to 2 if current shell
  414.     50:10    word    BASICs default DS value (DEF SEG)
  415.     50:12    dword    Pointer to BASIC ~INT 1C~ interrupt handler
  416.     50:16    dword    Pointer to BASIC ~INT 23~ interrupt handler
  417.     50:1A    dword    Pointer to BASIC ~INT 24~ disk error handler
  418.     50:20    word    DOS dynamic storage
  419.     50:22  14bytes    DOS diskette initialization table (~INT 1E~)
  420.     50:30    4bytes    MODE command
  421.     70:00        I/O drivers from IO.SYS/IBMBIO.COM
  422.  
  423. ^The following map varies in size and locus
  424.  
  425.     07C0:0        Boot code is loaded here at startup (31k mark)
  426.     A000:0        EGA/VGA RAM for graphics display mode 0Dh & above
  427.     B000:0        MDA RAM, Hercules graphics display RAM
  428.     B800:0        CGA display RAM
  429.     C000:0        EGA/VGA BIOS ROM (thru C7FF)
  430.     C400:0        Video adapter ROM space
  431.     C600:0 256bytes PGA communication area
  432.     C800:0     16K    Hard disk adapter BIOS ROM
  433.     C800:5        XT Hard disk ROM format, AH=Drive, AL=Interleave
  434.     D000:0     32K    Cluster adapter BIOS ROM
  435.     D800:0        PCjr conventionalsoftware cartridge address
  436.     E000:0     64K    Expansion ROM space (hardwired on AT+)
  437.          128K    PS/2 System ROM (thru F000)
  438.     F000:0        System monitor ROM
  439.             PCjr: software cartridge override address
  440.     F400:0        System expansion ROMs
  441.     F600:0        IBM ROM BASIC (AT)
  442.     F800:0        PCjr software cartridge override address
  443.     FC00:0        BIOS ROM
  444.     FF00:0        System ROM
  445.     FFA6:E        ROM graphics character table
  446.     FFFF:0        ROM bootstrap code
  447.     FFFF:5 8 bytes    ROM date (not applicable for all clones)
  448.     FFFF:E    byte    ROM machine id    (see ~MACHINE ID~)
  449.  
  450.  
  451. :boot sector:boot record
  452. ^Boot Sector (since DOS 2.0)
  453.  
  454. %     Offset  Size        Description
  455.  
  456.     00   3bytes    jump to executable code
  457.     03   8bytes    OEM name and version
  458.     0B   word    bytes per sector
  459.     0D   byte    sectors per cluster (allocation unit size)
  460.     0E   word    number of reserved sectors (starting at 0)
  461.     10   byte    number of FAT's on disk
  462.     11   word    number of root directory entries (directory size)
  463.     13   word    number of total sectors (0 if partition > 32Mb)
  464.     15   byte    media descriptor byte  (see ~MEDIA DESCRIPTOR~)
  465.     16   word    sectors per FAT
  466.     18   word    sectors per track  (DOS 3.0+)
  467.     1A   word    number of heads  (DOS 3.0+)
  468.     1C   word    number of hidden sectors  (DOS 3.0+)
  469.     20   dword    (DOS 4+) number of sectors if offset 13 was 0
  470.     24   byte    (DOS 4+) physical drive number
  471.     25   byte    (DOS 4+) reserved
  472.     26   byte    (DOS 4+) signature byte (29h)
  473.     27   dword    (DOS 4+) volume serial number
  474.     2B  11bytes    (DOS 4+) volume label
  475.     36   8bytes    (DOS 4+) reserved
  476.  
  477.  
  478.     - implementation format not guaranteed in all OEM DOS releases
  479.     - BIOS expects a boot sector of 512 bytes
  480.     - DOS 3.2 began reading BIOS Parameter Block (~BPB~) information from
  481.       the boot sector, previous versions used only the media byte in FAT
  482.     - DOS 4.x added offsets 20-3Dh and offset 20h determines the number
  483.       of sectors if offset 13h is zero
  484.     - hard disks have a master boot record and partition boot records;
  485.       the master boot record and ~Disk Partition Table~ (DPT) share the
  486.       same sector
  487.  
  488. :Box Drawing Chars
  489. ^Box Drawing Characters
  490.  
  491.        218  196  194  191          201  205  203  187
  492.         ┌─────────┬────┐             ╔═════════╦════╗
  493.     179 │    197  │    │ 179     186 ║    206  ║    ║ 186
  494.             │       \ │    │             ║       \ ║    ║
  495.     195 ├─────────┼────┤ 180     204 ╠═════════╬════╣ 185
  496.             │          │    │            ║         ║    ║
  497.             └─────────┴────┘             ╚═════════╩════╝
  498.          192  196  193  217            200  205  202  188
  499.  
  500.  
  501.        214  196  210  183             213  205  209  184
  502.             ╓─────────╥────╖            ╒═════════╤════╕
  503.         186 ║    215  ║    ║ 186    179 │    216  │    │ 179
  504.             ║       \ ║    ║            │       \ │    │
  505.         199 ╟─────────╫────╢ 182    198 ╞═════════╪════╡ 181
  506.             ║         ║    ║                │         │    │
  507.             ╙─────────╨────╜                ╘═════════╧════╛
  508.            211  196  208  189             212  205  207  190
  509.  
  510.  
  511.     - see   ~ASCII~
  512.  
  513. :code pages
  514. ^Code Page and Country Codes
  515.  
  516. %                  Country Keyboard    Valid Code
  517. %    Country            Code    Code      Pages
  518.  
  519.     Arabic            785         437
  520.     Australia        061     US     437,850
  521.     Belgium         032     BE     437,850
  522.     Canada (English)    001     US     437,850
  523.     Canada (French)        002     CF     863,850
  524.     Denmark         045     DK     865,850
  525.     Finland         358     SU     437,850
  526.     France            033     FR     437,850
  527.     Germany         049     GR     437,850
  528.     Hebrew            972         437
  529.     Italy            039     IT     437,850
  530.     Latin America        003     LA     437,850
  531.     Netherlands        031     NL     437,850
  532.     Norway            047     NO     865,850
  533.     Portugal        351     PO     860,850
  534.     Spain            034     SP     437,850
  535.     Sweden            046     SV     437,850
  536.     Switzerland (French)    041     SF     437,850
  537.     Switzerland (German)    041     SF     437,850
  538.     United Kingdom        044     UK     437,850
  539.     United States        001     US     437,850
  540.  
  541.     - code pages are lookup tables containing the definition
  542.       of one or more character sets
  543.     - contain country specific information
  544.     - implemented starting with DOS 3.3
  545.  
  546. :colors:color table
  547. ^Color Definitions
  548.  
  549. %    Definitions found in TURBO C's "conio.h"
  550.  
  551.     0 - BLACK    4 - RED        8 - DARKGRAY    C - LIGHTRED
  552.     1 - BLUE     5 - MAGENTA    9 - LIGHTBLUE   D - LIGHTMAGENTA
  553.     2 - GREEN    6 - BROWN        A - LIGHTGREEN  E - YELLOW
  554.     3 - CYAN     7 - LIGHTGRAY  B - LIGHTCYAN   F - WHITE
  555.  
  556.  
  557.        │7│6│5│4│3│2│1│0│ AL
  558.     │ │ │ │ │ │ │ └─── blue component of foreground color
  559.     │ │ │ │ │ │ └──── green component of foreground color
  560.     │ │ │ │ │ └───── red component of foreground color
  561.     │ │ │ │ └────── INTENSITY component of foreground color
  562.     │ │ │ └─────── blue component of background color
  563.     │ │ └──────── green component of background color
  564.     │ └───────── red component of background color
  565.     └────────── BLINKING of foreground character
  566.  
  567.     - see  ~ANSI~  for ANSI color definitions
  568. :country codes:country info
  569. ^DOS Country Codes   (DOS 2.x)
  570.  
  571. %     Offset Size        Description
  572.  
  573.     00   word    Date and time format
  574.               0 = month day year,  hh:mm:ss  (USA)
  575.               1 = day month year,  hh:mm:ss  (Europe)
  576.               2 = year month day,  hh:mm:ss  (Japan)
  577.     02  2bytes   ASCIIZ currency symbol
  578.     04  2bytes   ASCIIZ thousands separator
  579.     06  2bytes   ASCIIZ decimal separator
  580.     08  18bytes  Reserved
  581.  
  582.  
  583. ^DOS Country Codes   (DOS 3.0+)
  584.  
  585. %     Offset Size        Description
  586.  
  587.     00   word    Date and time format
  588.               0 = month day year,  hh:mm:ss  (USA)
  589.               1 = day month year,  hh:mm:ss  (Europe)
  590.               2 = year month day,  hh:mm:ss  (Japan)
  591.     02  5bytes   ASCIIZ currency symbol
  592.     07  2bytes   ASCIIZ thousands separator
  593.     09  2bytes   ASCIIZ decimal separator
  594.     0B  2bytes   ASCIIZ date separator
  595.     0D  2bytes   ASCIIZ time separator
  596.     0F   byte    Currency symbol format
  597.             0 = symbol leads, without space
  598.             1 = symbol follows, without space
  599.             2 = symbol leads, one space
  600.             3 = symbol follows, one space
  601.             4 = symbol replace decimal separator
  602.     10   byte    Number of digits after decimal
  603.     11   byte    Time format
  604.             Bit 0    = 0  12 hour clock
  605.                 = 1  24 hour clock
  606.     12   dword   Case map call address
  607.     16  2bytes   ASCIIZ data list separator
  608.     18  10bytes  Reserved
  609.  
  610.     - see also  ~INT 21,38~
  611.  
  612. :disk partition table:partition table
  613. ^Disk Partition Table (Fixed disk boot record)
  614.  
  615. %      Offset        Represents:  (see format below)
  616.  
  617.     01BE        Partition 1 data table  (16 bytes)
  618.     01CE        Partition 2 data table  (16 bytes)
  619.     01DE        Partition 3 data table  (16 bytes)
  620.     01EE        Partition 4 data table  (16 bytes)
  621.     01FE        Signature  (hex 55 AA, 2 bytes)
  622.  
  623. %    Offset from beginning of partition data shown above:
  624.  
  625. %     Offset Size        Description
  626.  
  627.     00   byte   boot indicator
  628.     01   byte   beginning sector head number
  629.     02   byte   beginning sector (2 high bits of cylinder #)
  630.     03   byte   beginning cylinder# (low order bits of cylinder #)
  631.     04   byte   system indicator
  632.     05   byte   ending sector head number
  633.     06   byte   ending sector (2 high bits of cylinder #)
  634.     07   byte   ending cylinder# (low order bits of cylinder #)
  635.     08   dword  number of sectors preceding the partition
  636.     0B   dword  number of sectors in the partition
  637.  
  638.  
  639. %    Boot indicator (BYTE)
  640.  
  641.     00  - non-bootable partition
  642.     80  - bootable partition (one partition only)
  643.  
  644.  
  645. %    System Indicator (BYTE)
  646.  
  647.     00 - unknown operating system
  648.     01 - DOS with 12 bit FAT, 16 bit sector number
  649.     02 - XENIX
  650.     04 - DOS with 16 bit FAT, 16 bit sector number
  651.     05 - DOS Extended partition (DOS 3.3+)
  652.     06 - DOS 4.0 (Compaq 3.31), 32 bit sector number
  653.     51 - Ontrack extended partition
  654.     64 - Novell
  655.     75 - PCIX
  656.     DB - CP/M
  657.     FF - BBT
  658.  
  659.  
  660. %    Signature
  661.  
  662.     Hex 55AA marks the end of valid boot sector.     This is also
  663.     required in each of the partition boot records.
  664.  
  665.  
  666. %    Sector/Cylinder
  667.  
  668.     2 bytes are combined to a word similar to INT 13:
  669.  
  670.     │7│6│5│4│3│2│1│0│ 1st byte  (sector)
  671.      │ │ └─┴─┴─┴─┴─┴── Sector offset within cylinder
  672.      └─┴───────────── High order bits of cylinder #
  673.  
  674.     │7│6│5│4│3│2│1│0│ 2nd byte  (cylinder)
  675.      └─┴─┴─┴─┴─┴─┴───── Low order bits of cylinder #
  676.  
  677.  
  678.     - all partitions begin on sector 1 head 0, except the first
  679.       partition which follows the disk's master boot record and begins
  680.       in sector 2
  681.     - some of this information may vary with some variants of DOS 3.2
  682.       and DOS 3.3 that use their own sectoring scheme for large disks
  683.  
  684.     - see  ~INT 21,32~  ~Disk Partition Table~
  685.  
  686. :device attributes
  687. ^Device Driver Attribute Values (brief)
  688.  
  689.        │F│E│D│C│B│A-7│6│5│4│3│2│1│0│
  690.     │ │ │ │ │  │  │ │ │ │ │ │ └── 1 = character device is stdin
  691.     │ │ │ │ │  │  │ │ │ │ │ │     1 = block dev supports generic IOCTL
  692.     │ │ │ │ │  │  │ │ │ │ │ └─── 1 = character device is stdout
  693.     │ │ │ │ │  │  │ │ │ │ │      1 = block dev supports generic IOCTL
  694.     │ │ │ │ │  │  │ │ │ │ └──── 1 = current NUL device
  695.     │ │ │ │ │  │  │ │ │ └───── 1 = current clock device
  696.     │ │ │ │ │  │  │ └─┴────── reserved by DOS
  697.     │ │ │ │ │  │  └───────── 1 = supports Get/Set logical device
  698.     │ │ │ │ │  └─────────── reserved (must be zero)
  699.     │ │ │ │ └───────────── 1 = supports removable media
  700.     │ │ │ └────────────── reserved (must be zero)
  701.     │ │ └─────────────── 1 = non-IBM format (block device)
  702.     │ │             1 = output until busy (char device)
  703.     │ └──────────────── 1 = supports IOCTL strings
  704.     └───────────────── 1 = character device, 0 = block device
  705.  
  706.     - true bit values are described, a false indicates opposite
  707.     - see  ~INT 21,44~  or  IOCTL,n where "n" is an IOCTL function
  708.  
  709.  
  710. ^Device Driver Attribute Bit Values (detailed)
  711.  
  712.      0  standard input device: used by character devices to
  713.         tell DOS a character device driver is the standard
  714.         input device.  For block devices, a 1 indicates generic
  715.         IOCTL supported
  716.  
  717.      1  standard output device: used by character devices to tell DOS a
  718.         character device driver is the standard output device.  For
  719.         block devices, a 1 indicates generic IOCTL supported
  720.  
  721.      2  NUL attribute:  used for character devices only.  Tells
  722.         DOS the character device driver is a NUL device.  This bit
  723.         is used by DOS to determine if the NUL device is being used.
  724.         The NUL device cannot be reassigned.
  725.  
  726.      3  clock device:  set to 1 to tell DOS this is the new CLOCK$ device.
  727.  
  728.     0B  open/close removable media:  set to 1 tells DOS the device
  729.         driver can handle removable media. (DOS 3.x)
  730.  
  731.     0D  non-IBM format: for block devices, indicates the method
  732.         the driver uses to determine media type.  Set to 1 for
  733.         drivers that use the BPB to determine media type, set to
  734.         zero for drivers that use the media descriptor byte.  For
  735.         character devices (usually printers), set to 1 if the
  736.         driver supports output until busy, set to 0 otherwise.
  737.  
  738.     0E  IOCTL bit:    used with both character and block devices.
  739.         Indicates if the device driver can handle control strings
  740.         through the IOCTL.    Zero if a device driver can't process
  741.         control strings.  If an attempt to send/receive an IOCTL
  742.         control strings, is made without this bit set, an error code
  743.         is returned.  The IOCTL functions allow data to be sent to
  744.         and from the driver without doing normal reads or writes.
  745.         The device driver can use the data for information.  It is
  746.         up to the device to interpret the string, but the information
  747.         must not be treated as a normal I/O request.  Affects
  748.         only IOCTL functions  AL=2 and AL=5.
  749.  
  750.     0F  device type:  used to indicate block or character device.
  751.  
  752. :device command codes
  753. ^Device Command Codes (Device Request Header)
  754.  
  755. %      Code        Function
  756.  
  757.     0    INIT
  758.     1    MEDIA CHECK    (block devices,character = NOP)
  759.     2    BUILD BPB        (block devices,character = NOP)
  760.     3    IOCTL
  761.     4    INPUT        (read)
  762.     5    NONDESTRUCTIVE INPUT NO WAIT (character devices)
  763.     6    INPUT STATUS    (character devices)
  764.     7    INPUT FLUSH    (character devices)
  765.     8    OUTPUT        (write)
  766.     9    OUTPUT        (write with verify)
  767.     10   OUTPUT STATUS    (character devices)
  768.     11   OUTPUT FLUSH    (character devices)
  769.     12   IOCTL OUTPUT
  770.     13   DEVICE OPEN    (DOS 3.x)
  771.     14   DEVICE CLOSE    (DOS 3.x)
  772.     15   REMOVABLE MEDIA    (DOS 3.x)
  773.  
  774. :device header
  775. ^Device Driver Header
  776.  
  777.  
  778. %     Offset Size        Description
  779.  
  780.     00   dword  pointer to next device header
  781.     04   word   attribute  (see ~DEVICE ATTRIBUTE~)
  782.     06   word   pointer to device strategy routine
  783.     08   word   pointer to device interrupt routine
  784.     0A  8bytes  name/unit field
  785.  
  786.  
  787.  
  788.     - see  ~INT 21,44~ and IOCTL,n where "n" is an IOCTL function
  789.  
  790. :device request headr
  791. ^Device Request Header Format
  792.  
  793.  
  794. %     Offset Size        Description
  795.  
  796.     00   byte    length in bytes of the request header
  797.     01   byte    unit code;  the sub-unit the operation is for (block
  798.             devices);  meaningless for character devices
  799.     02   word    command code, (see ~DEVICE COMMANDS~)
  800.     04  8bytes    reserved for DOS
  801.     0C  nbytes    request data  (variable length)
  802.  
  803.  
  804.     - see  ~INT 21,44~  or    ~DEVICE ATTRIBUTES~  or  ~DEVICE CODES~
  805.     - see also  IOCTL,n where "n" is an IOCTL function
  806.  
  807. :device status
  808. ^Device Status Word
  809.  
  810.     The device status word is set to zero on entry and is set by
  811.     the driver interrupt routine on return.
  812.  
  813.     │15│14-10│9│8│7-0│ STATUS word
  814.      │    │   │ │  └──── Error return code (if bit 15=1)
  815.      │    │   │ └────── Done bit, function completed
  816.      │    │   └─────── Busy bit
  817.      │    └────────── Reserved
  818.      └───────────── Error flag bits 0-7 have error code
  819.  
  820. %    Error return codes
  821.  
  822.     00  Write protect violation    01  Unknown unit
  823.     02  Device not ready        03  Unknown command
  824.     04  CRC error            05  Bad drive request structure length
  825.     06  Seek error            07  Unknown media
  826.     08  Sector not found        09  Printer out of paper
  827.     0A  Write fault         0B  Read fault
  828.     0C  General failure        0D  Reserved
  829.     0E  Reserved            0F  Invalid disk change
  830.  
  831. :directory format
  832. ^DIRECTORY - DOS Directory Structure
  833.  
  834. %    Byte    Description
  835.  
  836.     00    Filename status:
  837.         00 = Filename never used
  838.         05 = First character of filename is E5
  839.         E5 = File has been erased
  840.         2E = This is a subdirectory entry
  841.     00-07    Filename, left justified
  842.     08-0A    Filename extension, left justified
  843.     0B    File's attribute:
  844.  
  845.         │7│6│5│4│3│2│1│0│ byte 0B
  846.          │ │ │ │ │ │ │ └─── read only
  847.          │ │ │ │ │ │ └──── hidden
  848.          │ │ │ │ │ └───── system
  849.          │ │ │ │ └────── volume label
  850.          │ │ │ └─────── subdirectory
  851.          │ │ └──────── archive
  852.          └─┴───────── unused
  853.  
  854.     0C-15  Reserved by DOS
  855.     16-17  Time the file was created or last updated:
  856.  
  857.         │F│E│D│C│B│A│9│8│7│6│5│4│3│2│1│0│ 17,16
  858.          │ │ │ │ │ │ │ │ │ │ │ └─┴─┴─┴─┴─ seconds/2
  859.          │ │ │ │ │ └─┴─┴─┴─┴─┴────────── minutes
  860.          └─┴─┴─┴─┴───────────────────── hours
  861.  
  862.     18-19  Date the file was created or last updated:
  863.  
  864.         │F│E│D│C│B│A│9│8│7│6│5│4│3│2│1│0│ 19,18
  865.          │ │ │ │ │ │ │ │ │ │ │ └─┴─┴─┴─┴─ day 1-31
  866.          │ │ │ │ │ │ │ └─┴─┴─┴────────── month 1-12
  867.          └─┴─┴─┴─┴─┴─┴───────────────── year + 1980
  868.  
  869.     1A-1B  Starting cluster number of the first file cluster
  870.     1C-1F  File size in bytes (low order first)
  871.  
  872. :DBT:Disk Base Table
  873. ^DBT - Disk Base Table    (BIOS INT 13)
  874.  
  875. %     Offset Size        Description
  876.  
  877.     00   byte  specify byte 1; step-rate time, head unload time
  878.     01   byte  specify byte 2; head load time, DMA mode
  879.     02   byte  timer ticks to wait before disk motor shutoff
  880.     03   byte  bytes per sector code:
  881.  
  882.             0 - 128 bytes    2 - 512 bytes
  883.             1 - 256 bytes    3 - 1024 bytes
  884.  
  885.     04   byte  sectors per track (last sector number)
  886.     05   byte  inter-block gap length/gap between sectors
  887.     06   byte  data length, if sector length not specified
  888.     07   byte  gap length between sectors for format
  889.     08   byte  fill byte for formatted sectors
  890.     09   byte  head settle time in milliseconds
  891.     0A   byte  motor startup time in eighths of a second
  892.  
  893. :DTA:Disk Transfer Area
  894. ^DTA - Disk Transfer Area  (partially undocumented)
  895.  
  896.     DTA contains data, of which the first 21 bytes (00-15h) are known
  897.     as being "reserved for DOS use on subsequent find next calls"
  898.  
  899. %     Offset Size       Description
  900.  
  901.     00   byte    attribute of search (undocumented)
  902.     01   byte    drive used in search  (undocumented)
  903.     02  11bytes    search name used (undocumented)
  904.     0D   word    directory entry number (0 based, DOS 3.x+, undoc.)
  905.     0F   word    starting cluster number of current directory
  906.             zero for root directory    (DOS 3.x+, undocumented)
  907.     11   word    reserved (undocumented)
  908.     13   word    starting cluster number of current directory
  909.             zero for root directory    (DOS 2.x+, undocumented)
  910.     15   byte    attribute of matching file
  911.     16   word    file time  (see ~FILE ATTRIBUTES~)
  912.     18   word    file date  (see FILE ATTRIBUTES)
  913.     1A   word    file size
  914.     1E 13bytes    ASCIIZ filename and extension in the form NAME.EXT
  915.             with blanks stripped
  916.  
  917.  
  918.     - fields of DTA change dependent upon function call in progress
  919.     - the ~DTA~ cannot span a 64K segment boundary
  920.     - for compatibility with CP/M the default DTA is at offset 80h
  921.       in the ~PSP~;  this area is also used for the command tail. To
  922.       avoid collision, set another DTA (INT 21,1A) or preserve the
  923.       command tail before using ~FCB~ function calls
  924.  
  925.     - see  ~INT 21,4E~  ~INT 21,1A~  ~INT 21,2F~
  926.  
  927. :DOS error codes:extended errors
  928. ^DOS Error Codes
  929.  
  930.     Of the following error codes, only error codes 1-12 are
  931.     returned in AX upon exit from interrupt 21 or 24;  The rest
  932.     are obtained by issuing the "get extended error" function
  933.     call;  see ~INT 21,59~
  934.  
  935.     01  Invalid function number
  936.     02  File not found
  937.     03  Path not found
  938.     04  Too many open files (no handles left)
  939.     05  Access denied
  940.     06  Invalid handle
  941.     07  Memory control blocks destroyed
  942.     08  Insufficient memory
  943.     09  Invalid memory block address
  944.     0A  Invalid environment
  945.     0B  Invalid format
  946.     0C  Invalid access mode (open mode is invalid)
  947.     0D  Invalid data
  948.     0E  Reserved
  949.     0F  Invalid drive specified
  950.     10  Attempt to remove current directory
  951.     11  Not same device
  952.     12  No more files
  953.     13  Attempt to write on a write-protected diskette
  954.     14  Unknown unit
  955.     15  Drive not ready
  956.     16  Unknown command
  957.     17  CRC error
  958.     18  Bad request structure length
  959.     19  Seek error
  960.     1A  Unknown media type
  961.     1B  Sector not found
  962.     1C  Printer out of paper
  963.     1D  Write fault
  964.     1E  Read fault
  965.     1F  General failure
  966.     20  Sharing violation
  967.     21  Lock violation
  968.     22  Invalid disk change
  969.     23  FCB unavailable
  970.     24  Sharing buffer overflow
  971.     25  Reserved
  972.     26  Unable to complete file operation (DOS 4.x)
  973.     27-31 Reserved
  974.     32  Network request not supported
  975.     33  Remote computer not listening
  976.     34  Duplicate name on network
  977.     35  Network name not found
  978.     36  Network busy
  979.     37  Network device no longer exists
  980.     38  NetBIOS command limit exceeded
  981.     39  Network adapter error
  982.     3A  Incorrect network response
  983.     3B  Unexpected network error
  984.     3C  Incompatible remote adapter
  985.     3D  Print queue full
  986.     3E  No space for print file
  987.     3F  Print file deleted
  988.     40  Network name deleted
  989.     41  Access denied
  990.     42  Network device type incorrect
  991.     43  Network name not found
  992.     44  Network name limit exceeded
  993.     45  NetBIOS session limit exceeded
  994.     46  Temporarily paused
  995.     47  Network request not accepted
  996.     48  Print or disk redirection is paused
  997.     49-4F Reserved
  998.     50  File already exists
  999.     51  Reserved
  1000.     52  Cannot make directory entry
  1001.     53  Fail on INT 24
  1002.     54  Too many redirections
  1003.     55  Duplicate redirection
  1004.     56  Invalid password
  1005.     57  Invalid parameter
  1006.     58  Network device fault
  1007.     59  Function not supported by network (DOS 4.x)
  1008.     5A  Required system component not installed (DOS 4.x)
  1009.  
  1010.  
  1011. ^DOS Error Code/Classes
  1012.  
  1013. %    Error Classes
  1014.  
  1015.     01  Out of resource, out of space, channel, etc
  1016.     02  Temporary situation, not an error, ex: file lock
  1017.     03  Authorization, permission denied
  1018.     04  Internal, system detected internal error
  1019.     05  Hardware failure, serious problem related to hardware
  1020.     06  System failure, ex: invalid configuration
  1021.     07  Application error, inconsistent request
  1022.     08  Not found, file/item not found
  1023.     09  Bad format, file/item in invalid format
  1024.     0A  Locked, file/item interlocked
  1025.     0B  Media failure, ECC/CRC error, wrong or bad disk
  1026.     0C  Already exists, collision with existing item
  1027.     0D  Unknown, classification doesn't exist or is inappropriate
  1028.  
  1029.  
  1030. ^DOS Error Code/Action Codes and Locus
  1031.  
  1032. %    Error Action Codes  (in BL)
  1033.  
  1034.     01  retry, attempt a few more times and re-prompt
  1035.     02  delay retry, retry a few more times after a pause
  1036.     03  re-enter input, prompt user to re-enter input
  1037.     04  abort with cleanup, orderly abort and shutdown
  1038.     05  immediate abort, exit immediately without cleanup
  1039.     06  ignore error
  1040.     07  user intervention, retry after user fixes the problem
  1041.  
  1042. %    Error Locus (in CH)
  1043.  
  1044.     01  unknown
  1045.     02  block device
  1046.     03  network
  1047.     04  serial device
  1048.     05  memory
  1049.  
  1050. :DOS versions:version
  1051. ^VERSION - Versions of DOS
  1052.  
  1053. %     Version    Date        Changes
  1054.  
  1055.     PC-DOS 1.0   Oct 1981  original release, single sided drive
  1056.     PC-DOS 1.1   Jun 1982  bugfix, double sided drive support
  1057.     MS-DOS 1.25  Jun 1982  for early compatibles
  1058.     PC-DOS 2.0   Mar 1983  PC/XT, added (hard drive &UNIX features)
  1059.     PC-DOS 2.1   Oct 1983  PCjr & portable mods, fixes for 2.0
  1060.     MS-DOS 2.11  Oct 1983  compatible equivalent to 2.1
  1061.     PC-DOS 3.0   Aug 1984  support for 1.2 Mb drive (AT)
  1062.     PC-DOS 3.1   Nov 1984  added network support, fixes for 3.0
  1063.     MS-DOS 2.25  Oct 1985  compatible; foreign language support
  1064.     PC-DOS 3.2   Jul 1986  720k 3½" drive support for Convertible
  1065.     MS-DOS 3.2   Jul 1986
  1066.     MS-DOS 3.21  May 1987
  1067.     MS-DOS 3.3   Jul 1987
  1068.     PC-DOS 3.3   Apr 1987  PS/2, 1.44 disk support, mult. partitions
  1069.     MS-DOS 3.30a Feb 1988
  1070.     CPQ-DOS 3.31 Oct 1988  Compaq DOS for disk partitions > 32MB
  1071.     PC-DOS 4.00  Aug 1988  Larger DOS partitions, EMS support (bugs)
  1072.     MS-DOS 4.00  Oct 1988
  1073.     MS-DOS 4.01  Nov 1988
  1074.     MS-DOS 4.01a Apr 1989
  1075.     PC-DOS 4.01  ??? ????  Fixes for major bugs in 4.0
  1076.  
  1077.  
  1078.     - release dates vary between OEM versions
  1079.     - IBM was supposedly responsible for most changes in DOS 4.x
  1080.     - DOS 4.01 reports version 4.0, except in some vendor versions
  1081.     - DOS 5.0 is primarily a Microsoft developed version
  1082.  
  1083. :drive parameter tbl:disk parameter table:DPB:DPT
  1084. ^DPT/DPB - Drive Parameter Table / Disk Parameter Block
  1085.  
  1086. %     Offset Size        Description
  1087.  
  1088.     00   byte    drive (0 = A, 1 = B)
  1089.     01   byte    unit within device, usually equals drive (ramdisk=0)
  1090.     02   word    bytes per sector
  1091.     04   byte    sectors per cluster minus 1
  1092.     05   byte    sectors per cluster (times to shift left or x2)
  1093.     06   word    number of sectors before FAT (boot sectors)
  1094.     08   byte    number of ~FAT~ copies
  1095.     09   word    number of root directory entries
  1096.     0B   word    number of first data sector
  1097.     0D   word    total number of clusters plus 1
  1098.     0F   byte    number of sectors used by first FAT
  1099.  
  1100. %    The following fields are DOS version dependant
  1101.  
  1102.     10   word    number of first sector in root directory
  1103.     12   dword    far pointer to current disk device header
  1104.     16   byte    media descriptor byte (see ~MEDIA DESCRIPTOR~)
  1105.     17   byte    zero if disk accessed, (default=FF, must rebuild ~DPB~)
  1106.     18   dword    far pointer to next drive parameter table; offset
  1107.             is set to FFFFh if last block in chain
  1108.     1C   word    current directory cluster number; 0=root
  1109.     1E  64bytes    ASCIIZ current working directory
  1110.  
  1111.  
  1112. ^Fields differing in DOS 3.x
  1113.  
  1114. %     Offset Size        Description
  1115.     1C   word    starting cluster for free space search
  1116.     1E  64bytes    number of free clusters; FFFFh = unknown
  1117.  
  1118.  
  1119. ^Fields differing in DOS 4.x
  1120.  
  1121. %     Offset Size        Description
  1122.     11   word    first sector of root directory
  1123.     13   dword    far pointer to current disk device header
  1124.     17   byte    media descriptor byte (see ~MEDIA DESCRIPTOR~)
  1125.     18   byte    zero if disk accessed, (default=FF, must rebuild ~DPB~)
  1126.     19   dword    pointer to next drive parameter table; offset
  1127.             is set to FFFFh if last block in chain
  1128.     1D   word    starting cluster for free space search
  1129.     1F   word    number of free clusters, FFFFh = unknown
  1130.  
  1131.  
  1132.     - ~INT 21,32~ which is used to read this data resets accessed byte at
  1133.       offset 17h or 18h (depending on DOS version)
  1134.     - dword at offset 12h & 13h aren't supported in OS/2 compatability box
  1135.     - sector references are DOS logical sectors
  1136.     - see    ~Disk Base Table~  ~BPB~  ~INT 21,1F~  ~INT 21,32~
  1137. :drive status data:disk status data:diskette status data
  1138. ^Drive Status Bytes Found in BIOS Data Area
  1139.  
  1140. %        Drive recalibration status (at 40:3E)
  1141.  
  1142.         │7│6│5│4│3│2│1│0│ byte at 40:3E
  1143.          │ │ │ │ │ │ │ └─── 1=recalibrate drive 0
  1144.          │ │ │ │ │ │ └──── 1=recalibrate drive 1
  1145.          │ │ │ │ │ └───── 1=recalibrate drive 2
  1146.          │ │ │ │ └────── 1=recalibrate drive 3
  1147.          │ └─┴─┴─────── unused
  1148.          └──────────── 1=working interrupt flag
  1149.  
  1150. %        Diskette motor status
  1151.  
  1152.         │7│6│5│4│3│2│1│0│ byte at 40:3F
  1153.          │ │ │ │ │ │ │ └─── 1=drive 0 motor on
  1154.          │ │ │ │ │ │ └──── 1=drive 1 motor on
  1155.          │ │ │ │ │ └───── 1=drive 2 motor on
  1156.          │ │ │ │ └────── 1=drive 3 motor on
  1157.          │ └─┴─┴─────── unused
  1158.          └──────────── 1=write operation
  1159.  
  1160. %        Disk Status Byte
  1161.  
  1162.         │7│6│5│4│3│2│1│0│ byte at 40:41
  1163.          │ │ │ │ │ │ │ └─── invalid diskette command
  1164.          │ │ │ │ │ │ └──── diskette address mark not found
  1165.          │ │ │ │ │ └───── sector not found
  1166.          │ │ │ │ └────── diskette DMA error
  1167.          │ │ │ └─────── CRC check / data error
  1168.          │ │ └──────── diskette controller failure
  1169.          │ └───────── seek to track failed
  1170.          └────────── diskette time-out
  1171.  
  1172. %        Last diskette data rate selected
  1173.  
  1174.         │7│6│5│4│3│2│1│0│ byte at 40:8B
  1175.          │ │ │ │ └─┴─┴─┴─── step rate time selected (see below)
  1176.          └─┴─┴─┴────────── data rate selected (see below)
  1177.  
  1178. %        Bits
  1179. %         76  Diskette Data Rate Selected
  1180.          00  500K bps
  1181.          01  300K bps
  1182.          10  250K bps
  1183.          11  reserved
  1184.  
  1185. %        Bits
  1186. %         54  Diskette Step Rate Time Selected
  1187.          00  step rate time of 0C
  1188.          01  step rate time of 0D
  1189.          10  step rate time of 0A
  1190.          11  reserved
  1191.  
  1192. %        Media state for fixed drives (bytes at 40:90-93)
  1193.  
  1194.         │7│6│5│4│3│2│1│0│ bytes at 40:90-40:93
  1195.          │ │ │ │ │ └─┴─┴─── reserved (set to 1)
  1196.          │ │ │ │ └──────── reserved
  1197.          │ │ │ └───────── 0=media/drive unestablished
  1198.          │ │ └────────── reserved
  1199.          └─┴─────────── data rate (see below)
  1200.  
  1201. %        Bits
  1202. %         76  Fixed Disk Data Rate Selected
  1203.          00  500K bps
  1204.          01  reserved
  1205.          10  250K bps
  1206.          11  reserved
  1207.  
  1208.     - not all OEM's implemented these bytes identically.  Some are
  1209.       also AT specific.
  1210.  
  1211. :EXE file header:.EXE
  1212. ^.EXE - DOS EXE File Structure
  1213.  
  1214. %     Offset Size         Description
  1215.  
  1216.     00   word  "MZ" - Link file .EXE signature (Mark Zbikowski?)
  1217.     02   word  length of image mod 512
  1218.     04   word  size of file in 512 byte pages
  1219.     06   word  number of relocation items following header
  1220.     08   word  size of header in 16 byte paragraphs, used to locate
  1221.              the beginning of the load module
  1222.     0A   word  min # of paragraphs needed to run program
  1223.     0C   word  max # of paragraphs the program would like
  1224.     0E   word  offset in load module of stack segment (in paras)
  1225.     10   word  initial SP value to be loaded
  1226.     12   word  negative checksum of pgm used while by EXEC loads pgm
  1227.     14   word  program entry point, (initial IP value)
  1228.     16   word  offset in load module of the code segment (in paras)
  1229.     18   word  offset in .EXE file of first relocation item
  1230.     1A   word  overlay number (0 for root program)
  1231.  
  1232.     - relocation table and the program load module follow the header
  1233.     - relocation entries are 32 bit values representing the offset
  1234.       into the load module needing patched
  1235.     - once the relocatable item is found, the CS register is added to
  1236.       the value found at the calculated offset
  1237.  
  1238. %    Registers at load time of the EXE file are as follows:
  1239.  
  1240.     AX:    contains number of characters in command tail, or 0
  1241.     BX:CX    32 bit value indicating the load module memory size
  1242.     DX    zero
  1243.     SS:SP    set to stack segment if defined else,  SS = CS and
  1244.         SP=FFFFh or top of memory.
  1245.     DS    set to segment address of EXE header
  1246.     ES    set to segment address of EXE header
  1247.     CS:IP    far address of program entry point, (label on "END"
  1248.         statement of program)
  1249.  
  1250. :EBDA:extended BIOS
  1251. ^EBDA - Extended BIOS Data Area EBDA (PS/2)
  1252.  
  1253. %     Offset     Size         Description
  1254.  
  1255.     00     word       number of bytes allocated to EBDA in Kbytes
  1256.     01-21     21bytes   reserved
  1257.     22     dword       device driver far call pointer
  1258.     26     byte       pointing device flag (1st byte, see below)
  1259.     27     byte       pointing device flag (2nd byte, see below)
  1260.     28-2F     8 bytes   reserved
  1261.  
  1262.  
  1263. %        Pointing Device Flag Byte 1
  1264.  
  1265.         │7│6│5│4│3│2│1│0│ Offset 26
  1266.          │ │ │ │ │ └─┴─┴─── index count
  1267.          │ │ │ │ └──────── reserved (0)
  1268.          │ │ │ └───────── error
  1269.          │ │ └────────── acknowledge
  1270.          │ └─────────── resend
  1271.          └──────────── command in progress
  1272.  
  1273. %        Pointing Device Flag Byte 2
  1274.  
  1275.         │7│6│5│4│3│2│1│0│ Offset 27
  1276.          │ │ │ │ │ └─┴─┴─── package size
  1277.          │ └─┴─┴─┴──────── reserved
  1278.          └─────────────── device driver far call flag
  1279.  
  1280.  
  1281.     - EBDA is located in highest memory just under 640K on PS/2
  1282.     - word at ~BIOS Data Area~ 40:0E is segment address of EBDA
  1283.  
  1284. :FAT:File Allocation Table
  1285. ^FAT - File Allocation Table
  1286.  
  1287. %    12 Bit              Meaning            16 Bit
  1288.  
  1289.      000             free space             0000
  1290.      FF1-FF7          bad track marking             FFF1-FFF7
  1291.      FF8-FFE   may be used to mark end of a file chain   FFF8-FFFE
  1292.      FFF       standard marker for end of a file chain   FFFF
  1293.  
  1294.  
  1295.     - the FAT is implemented as an array containing a linked list
  1296.       for each file;  the files directory entry has a pointer to the
  1297.       first cluster which contains the cluster number of the next
  1298.       cluster in the chain until the pointer contained is FFFh
  1299.       (12 bit FAT) and FFFFh (16 bit FAT) marking end of file
  1300.     - DOS maintains two copies of the FAT, but does not use the
  1301.       second copy for anything other than a mirror image of the
  1302.       first;  CHKDSK doesn't even read the second FAT
  1303.     - disks with FF1h clusters and above use 16 bit FAT tables, disk
  1304.       with less use 12 bit FAT tables
  1305.     - DOS 4.x did not change the size of the cluster number as some
  1306.       suggest, but instead increased the size of the sector number
  1307.     - bytes 0 of the FAT contains the Media Descriptor Byte
  1308.  
  1309.  
  1310. ^Calculating 12 bit FAT Entries
  1311.  
  1312.     1. Get starting cluster from directory entry.
  1313.  
  1314.     2. Multiply the cluster number just used by 1.5
  1315.  
  1316.     3. The whole part of the product is the offset into the FAT,
  1317.        of the entry that maps to the cluster in the directory.
  1318.        This entry contains the number of the next cluster.
  1319.  
  1320.     4. Move the word at the calculated FAT into a register.
  1321.  
  1322.     5. If the last cluster used was an even number, keep the low order
  1323.        12 bits of the register, otherwise, keep the high order 12 bits.
  1324.  
  1325.     6. If the resultant 12 bits are (0FF8h-0FFFh) no more clusters
  1326.        are in the file.  Otherwise, the next 12 bits contain the
  1327.        cluster number of the next cluster in the file.
  1328.  
  1329.  
  1330. ^Calculating 16 Bit FAT Entries
  1331.  
  1332.     1. Get the starting cluster of the file from the directory.
  1333.  
  1334.     2. Multiply the cluster number found by 2.
  1335.  
  1336.     3. Load the word at the calculated FAT offset into a register.
  1337.  
  1338.     4. If the 16 bits are (0FFF8h-0FFFFh) no more clusters are in
  1339.        the file. Otherwise, the 16 bits contain the cluster number
  1340.        of the next cluster in the file.
  1341.  
  1342.  
  1343.     To convert the cluster to a logical sector number (relative
  1344.     sector, similar to that used by DEBUG, int 25h and 26h):
  1345.  
  1346.     1. Subtract 2 from the cluster number
  1347.     2. Multiply the result by the number of sectors per cluster.
  1348.     3. Add the logical sector number of the beginning of the data area.
  1349.  
  1350.  
  1351.     - see  ~MEDIA DESCRIPTOR~
  1352.  
  1353. :FCB:File Control Block
  1354. ^FCB - Standard DOS File Control Block
  1355.  
  1356. %     Offset Size        Description
  1357.  
  1358.     -7   byte    if FF this is an extended FCB  ╪
  1359.     -6  5bytes    reserved  ╪ 
  1360.     -1   byte    file attribute if extended FCB    ╪
  1361.     00   byte    drive number (0 for default drive, 1=A:, 2=B:, ...)
  1362.     01  8bytes    filename, left justified with trailing blanks
  1363.     09  3bytes    filename extension, left justified w/blanks
  1364.     0C   word    current block number relative to beginning of the
  1365.             file, starting with zero
  1366.     0E   word    logical record size in bytes
  1367.     10   dword    file size in bytes
  1368.     14   word    date the file was created or last updated
  1369.  
  1370.         │F│E│D│C│B│A│9│8│7│6│5│4│3│2│1│0│ 15,14 (Intel reverse order)
  1371.          │ │ │ │ │ │ │ │ │ │ │ └─┴─┴─┴─┴─ day 1-31
  1372.          │ │ │ │ │ │ │ └─┴─┴─┴────────── month 1-12
  1373.          └─┴─┴─┴─┴─┴─┴───────────────── year + 1980
  1374.  
  1375.     16   word    time of last write
  1376.  
  1377.         │F│E│D│C│B│A│9│8│7│6│5│4│3│2│1│0│ 17,16 (Intel reverse order)
  1378.          │ │ │ │ │ │ │ │ │ │ │ └─┴─┴─┴─┴── secs in 2 second increments
  1379.          │ │ │ │ │ └─┴─┴─┴─┴─┴─────────── minutes (0-59)
  1380.          └─┴─┴─┴─┴────────────────────── hours (0-23)
  1381.  
  1382.     18  8bytes    see below for version specific information  ╪
  1383.     1A   dword    address of device header if character device  ╪
  1384.     20   byte    current relative record number within current BLOCK
  1385.     21   dword    relative record number relative to the beginning of
  1386.             the file, starting with zero; high bit omitted if
  1387.             record length is 64 bytes
  1388.  
  1389.  
  1390. ^DOS 2.x Values for reserved fields at offsets 18h-1Ah    ╪
  1391.  
  1392. %     Offset Size        Description
  1393.     18   byte    │7│6│5│4│3│2│1│0│
  1394.              │ │ └─┴─┴─┴─┴─┴─── unknown
  1395.              │ └────────────── 1 = open
  1396.              └─────────────── 1 = logical device
  1397.  
  1398.     19   word       starting cluster number  ╪
  1399.     
  1400.  
  1401. ^DOS 3.x Values for reserved fields at offsets 18h-19h    ╪
  1402.  
  1403. %     Offset Size        Description
  1404.     18   byte    System File Table (SFT) entry for file    ╪
  1405.     19   byte    attributes  ╪
  1406.  
  1407.             │7│6│5│4│3│2│1│0│  attributes
  1408.              │ │ └─┴─┴─┴─┴─┴──── unknown
  1409.              └─┴─ share status  
  1410.              
  1411.             00 = SHARE not loaded block device
  1412.             01 = SHARE not loaded characted device
  1413.             10 = SHARE loaded, remote file
  1414.             11 = SHARE loaded local file
  1415.  
  1416.  
  1417. ^DOS 3.x with SHARE, local file reserved offsets 1Ah-1Eh  ╪
  1418.  
  1419. %     Offset Size        Description
  1420.     1A   word    starting cluster number
  1421.     1C   word    offset within SHARE of sharing record
  1422.     1E   byte    file attribute
  1423.  
  1424.  
  1425. ^DOS 3.x with SHARE, remote file reserved offsets 1Ah-1Eh  ╪
  1426.  
  1427. %     Offset Size        Description
  1428.     1A   word    sector number containing directory entry
  1429.     1C   word    last cluster accessed relative to beginning of file
  1430.     1E   byte    absolute cluster number of last cluster accessed
  1431.  
  1432.  
  1433. ^DOS 3.x without SHARE reserved offsets 1Ah-1Fh  ╪
  1434.  
  1435. %     Offset Size        Description
  1436.     1A   byte    ((device attribute word low byte) & 0Ch) || (open mode)
  1437.     1B   word    starting cluster number
  1438.     1D   word    sector number containing directory entry
  1439.     1F   byte    number of directory entry within sector
  1440.  
  1441.  
  1442. %    The following are FCB related DOS functions:
  1443.  
  1444.     ~INT 21,F~   Open file using FCB
  1445.     ~INT 21,10~  Close file using FCB
  1446.     ~INT 21,11~  Search for first entry using FCB
  1447.     ~INT 21,12~  Search for next entry using FCB
  1448.     ~INT 21,13~  Delete file using FCB
  1449.     ~INT 21,14~  Sequential read using FCB
  1450.     ~INT 21,15~  Sequential write using FCB
  1451.     ~INT 21,16~  Create a file using FCB
  1452.     ~INT 21,17~  Rename file using FCB
  1453.     ~INT 21,21~  Random read using FCB
  1454.     ~INT 21,22~  Random write using FCB
  1455.     ~INT 21,23~  Get file size using FCB
  1456.     ~INT 21,24~  Set relative record field for FCB
  1457.     ~INT 21,27~  Random block read using FCB
  1458.     ~INT 21,28~  Random block write using FCB
  1459.     ~INT 21,29~  Parse filename for FCB
  1460.  
  1461.  
  1462.     ╪  see ~Bibliography~ reference to "Undocumented DOS"
  1463.  
  1464.     - see    ~XFCB~   ~INT 21,52~
  1465. :file attributes
  1466. ^DOS File Attributes
  1467.  
  1468. %    Directory Attribute Flags
  1469.  
  1470.     │7│6│5│4│3│2│1│0│ Directory Attribute Flags
  1471.      │ │ │ │ │ │ │ └─── 1 = read only
  1472.      │ │ │ │ │ │ └──── 1 = hidden
  1473.      │ │ │ │ │ └───── 1 = system
  1474.      │ │ │ │ └────── 1 = volume label  (exclusive)
  1475.      │ │ │ └─────── 1 = subdirectory
  1476.      │ │ └──────── 1 = archive
  1477.      └─┴───────── unused
  1478.  
  1479. %    Directory Time Format
  1480.  
  1481.     │F│E│D│C│B│A│9│8│7│6│5│4│3│2│1│0│ Directory Time Format
  1482.      │ │ │ │ │ │ │ │ │ │ │ └─┴─┴─┴─┴─── seconds (2 second increments)
  1483.      │ │ │ │ │ └─┴─┴─┴─┴─┴──────────── minutes (0-59)
  1484.      └─┴─┴─┴─┴─────────────────────── hours (0-23)
  1485.  
  1486. %    Directory Date Format
  1487.  
  1488.     │F│E│D│C│B│A│9│8│7│6│5│4│3│2│1│0│ Directory Date Format
  1489.      │ │ │ │ │ │ │ │ │ │ │ └─┴─┴─┴─┴─── Day (1-31)
  1490.      │ │ │ │ │ │ │ └─┴─┴─┴──────────── Month (1-12)
  1491.      └─┴─┴─┴─┴─┴─┴─────────────────── Year (less 1980)
  1492.  
  1493.  
  1494.     - with respect to the ~findfirst~() and ~findnext~() functions normal
  1495.       files are always included along with the requested attributes
  1496.       except when the LABEL attribute is requested.  It's up to the
  1497.       programmer to determine which files are match the requested
  1498.       attributes.
  1499. :file handles:default handles:handles
  1500. ^DOS Default/Predefined File Handles
  1501.  
  1502.      0 - Standard Input Device - can be redirected (STDIN)
  1503.      1 - Standard Output Device - can be redirected (STDOUT)
  1504.      2 - Standard Error Device - can be redirected (STDERR)
  1505.      3 - Standard Auxiliary Device (STDAUX)
  1506.      4 - Standard Printer Device (STDPRN)
  1507.  
  1508.  
  1509. %See the following  INT 21h  Handle related function calls:
  1510.  
  1511.     ~INT 21,3C~  Create file using handle
  1512.     ~INT 21,3D~  Open file using handle
  1513.     ~INT 21,3E~  Close file using handle
  1514.     ~INT 21,3F~  Read file or device using handle
  1515.     ~INT 21,40~  Write file or device using handle
  1516.     ~INT 21,41~  Delete file
  1517.     ~INT 21,42~  Move file pointer using handle
  1518.     ~INT 21,43~  Change file mode
  1519.     ~INT 21,45~  Duplicate file handle
  1520.     ~INT 21,46~  Force duplicate file handle
  1521.     ~INT 21,56~  Rename file
  1522.     ~INT 21,57~  Get/set file date and time using handle
  1523.     ~INT 21,5A~  Create temporary file (3.x+)
  1524.     ~INT 21,5B~  Create new file (3.x+)
  1525.     ~INT 21,67~  Set handle count (3.3+)
  1526.     ~INT 21,68~  Flush buffer (3.3+)
  1527.  
  1528.  
  1529.     - STDIN, STDOUT and STDERR can be redirected
  1530.     - maximum number of files available to all DOS processes at one
  1531.       time is defined by the FILES=N statement of ~CONFIG.SYS~
  1532.     - maximum number of files available to an application is N-3 where
  1533.       N is derived from the CONFIG.SYS FILES=N statement minus the
  1534.       count of handles used by other processes
  1535.     - ~INT 21,67~ can be used in DOS 3.3+ to increase the number of file
  1536.       handles for an application to greater than 20;  the max handle
  1537.       count is still limited by the value of FILES= in CONFIG.SYS file
  1538.     - An application can increase the maximum allowed file handles in
  1539.       DOS 3.0-3.2 by copying the open file table located through offset
  1540.       34h in the ~PSP~ to another location.  All unopened slots must be
  1541.       initialized to FF and the values at PSP offsets 32h and 34h must
  1542.       be updated to reflect the new values.
  1543.     - see    ~SFT~   ~INT 21~   ~INT 21,52~   ~INT 21,67~
  1544. :float formats:floating point:real numbers
  1545. ^Floating Point Formats
  1546.  
  1547. %    IEEE 4 byte real
  1548.  
  1549.     31 30     23 22                  0
  1550.     ┌─┬────────┬──────────────────────────┐
  1551.     │s│ 8 bits │msb   23 bit mantissa  lsb│
  1552.     └─┴────────┴──────────────────────────┘
  1553.      │    │         └────────────────  mantissa
  1554.      │    └────────────────────────────────  biased exponent (7fh)
  1555.      └─────────────────────────────────────  sign bit
  1556.  
  1557. %    IEEE 8 byte real
  1558.  
  1559.     63 62       52 51                  0
  1560.     ┌─┬──────────┬────────────────────────────────────┐
  1561.     │s│  11 bits │msb     52 bit mantissa       lsb│
  1562.     └─┴──────────┴────────────────────────────────────┘
  1563.      │    │         └────────────────  mantissa
  1564.      │    └────────────────────────────────  biased exponent (3FFh)
  1565.      └─────────────────────────────────────  sign bit
  1566.  
  1567. %    Microsoft 4 byte real
  1568.  
  1569.     31     24 23 22                  0
  1570.     ┌────────┬─┬──────────────────────────┐
  1571.     │ 8 bits │s│msb  23 bit mantissa   lsb│
  1572.     └────────┴─┴──────────────────────────┘
  1573.          │      │         └────────────────  mantissa
  1574.          │      └────────────────────────────  sign bit
  1575.          └──────────────────────────────  biased exponent (81h)
  1576.  
  1577. %    Microsoft 8 byte real (see note below)
  1578.  
  1579.     63    56 55 54                        0
  1580.     ┌───────┬─┬────────────────────────────────────┐
  1581.     │ 8bits │s│msb        52 bit mantissa        lsb│
  1582.     └───────┴─┴────────────────────────────────────┘
  1583.         │     │              └────────────  mantissa
  1584.         │     └─────────────────────────────  sign bit
  1585.         └───────────────────────────  biased exponent (401h, see below)
  1586.  
  1587. %    IEEE 10 byte real (temporary real)
  1588.  
  1589.     79 78        64 63 62                     0
  1590.     ┌─┬───────────┬─┬────────────────────────────────────────┐
  1591.     │s│  15 bits  │1│msb          63 bit mantissa          lsb│
  1592.     └─┴───────────┴─┴────────────────────────────────────────┘
  1593.      │    │      │            └─────  mantissa
  1594.      │    │      └────────────────────────  first mantissa bit
  1595.      │    └─────────────────────────────    biased exponent (3FFFh)
  1596.      └──────────────────────────────────  sign bit
  1597.  
  1598. %    Turbo Pascal 6 byte real
  1599.  
  1600.     47     40 39 38                    0
  1601.     ┌────────┬─┬────────────────────────────────────┐
  1602.     │ 8 bits │s│msb        39 bit mantissa         lsb│
  1603.     └────────┴─┴────────────────────────────────────┘
  1604.          │      │             └────────────  mantissa
  1605.          │      └─────────────────────────────  sign bit
  1606.          └────────────────────────────────  biased exponent (80h)
  1607.  
  1608. %    Microsoft Fortran Complex number
  1609.     ┌──────────────────────────┬─────────────────────────────┐
  1610.     │   Float Real component   │  Float Imaginary component  │
  1611.     └──────────────────────────┴─────────────────────────────┘
  1612.     (each component is either 8 or 16 byte IEEE real)
  1613.  
  1614.  
  1615.     - sign bit representation:  0 is positive  and    1 is negative
  1616.     - in all float formats except the IEEE 10 byte real, the
  1617.       mantissa is stored without most significant bit; since
  1618.       the state of this bit is known to be set, it is not
  1619.       included and the exponent is adjusted accordingly
  1620.     - all formats use binary float representation
  1621.     - memory representation uses 80x86 reverse byte/word order.
  1622.     - Microsoft languages use the IEEE real formats;  BASIC is the
  1623.       only normal user of the Microsoft float format
  1624.     - Microsoft 8 byte real format has not been verified;  several
  1625.       Microsoft publications show an 8 bit exponent instead of 11 bits
  1626.       and state the BIAS is 401h;  the discrepancy is that 8 bits can't
  1627.       hold the value 401h (requires 11 bits)
  1628.  
  1629.  
  1630. %    True exponent is the exponent value minus the following bias:
  1631.  
  1632.     81h for Microsoft 4 byte real
  1633.     401h for Microsoft 8 byte real
  1634.     7Fh for IEEE 4 byte real
  1635.     3FFh for IEEE 8 byte real
  1636.     80h for Turbo Pascal 6 byte real
  1637.  
  1638. %         Size           Range         Significant digits
  1639.  
  1640.     4 byte real      8.43x10E-37 to 3.37x10E38        6-7
  1641.     8 byte real     4.19x10E-307 to 1.67x10E308       15-16
  1642.     10 byte real     3.4x10E-4932 to 1.2x10E4932         19
  1643.  
  1644.  
  1645.     - see    ~dmsbintoieee~()   ~dieeetomsbin~()   ~NUMERIC RANGES~
  1646.  
  1647. :floppy formats:disk formats
  1648. ^Common Floppy Disk Formats
  1649.  
  1650. %           Supporting         ┌─────Sectors────┐   Entries
  1651. %      Disk      DOS           per    per  per   per     per   Total
  1652. %      Type     Vers  Sides Trks  TRK    FAT  DIR Cluster DIR  Sectors
  1653.     ─────────────────────────────────────────────────────────────
  1654.  
  1655.     5¼ 160k  (1.0)     1   (40)   8     1    4        1      64     320
  1656.  
  1657.     5¼ 320k  (1.1)     2   (40)   8     1    7        2     112     640
  1658.  
  1659.     5¼ 180k  (2.0)     1   (40)   9     2    4        1      64     360
  1660.  
  1661.     5¼ 360k  (2.0)     2   (40)   9     2    7        2     112     720
  1662.  
  1663.     5¼ 1.2M  (3.0)     2   (80)  15     7   14        1     224    2400
  1664.  
  1665.     3½ 720k  (3.2)     2   (80)   9     3    7        2     112    1440
  1666.  
  1667.     3½ 1.44M (3.3)     2   (80)  18     9   14        1     224    2880
  1668.  
  1669. :ID bytes:machine identificatn
  1670. ^Machine Identification Byte
  1671.  
  1672. %          Model  Sub-Model        Machine
  1673.  
  1674.         FF    ??    Original IBM PC  4/24/81
  1675.             ??    IBM PC    10/19/81
  1676.             ??    IBM PC    10/27/82
  1677.         FE    ??    IBM XT (Original)
  1678.             ??    IBM portable PC
  1679.             ??    Compaq DeskPro
  1680.         FD    ??    PCjr
  1681.         FC    ??    IBM AT (6 MHz)
  1682.             01    IBM AT 3x9 (8 MHz)
  1683.             02    IBM XT 286
  1684.             04    IBM PS/2 Model 50
  1685.             05    IBM PS/2 Model 60
  1686.             0B    IBM PS/1
  1687.         FB    00    IBM 256/640K XT (aka XT/2)
  1688.         FA    00    IBM PS/2 Model 30
  1689.             01    IBM PS/2 Model 25
  1690.         F9    00    IBM PC Convertible
  1691.         F8    00    IBM PS/2 Model 80  (16 MHz)
  1692.             01    IBM PS/2 Model 80  (20 MHz)
  1693.             04    IBM PS/2 Model 70  (20 MHz)
  1694.             09    IBM PS/2 Model 70  (16 MHz)
  1695.         B6    ??    Hewlett Packard 110
  1696.         9A    ??    Compaq Plus
  1697.         86        XT (BIOS 11/82+) & AT (BIOS 1/84+) (see note)
  1698.         80        PC & PCjr (see note)
  1699.         2D    ??    Compaq PC
  1700.  
  1701.  
  1702.     - found at memory location F000:FFFE or via INT 15,C0
  1703.     - model values of 80 & 86 are returned by BIOS versions previous
  1704.       to the PS/2 but after the BIOS dates marked
  1705.  
  1706.     - see    ~INT 15,C0~
  1707.  
  1708. :KB flags:keyboard flags
  1709. ^Keyboard Flags Bytes 0 and 1
  1710.  
  1711.         │7│6│5│4│3│2│1│0│  40:17  Keyboard Flags Byte 0
  1712.          │ │ │ │ │ │ │ └──── right shift key depressed
  1713.          │ │ │ │ │ │ └───── left shift key depressed
  1714.          │ │ │ │ │ └────── CTRL key depressed
  1715.          │ │ │ │ └─────── ALT key depressed
  1716.          │ │ │ └──────── scroll-lock is active
  1717.          │ │ └───────── num-lock is active
  1718.          │ └────────── caps-lock is active
  1719.          └─────────── insert is active
  1720.  
  1721.         │7│6│5│4│3│2│1│0│  40:18  Keyboard Flags Byte 1
  1722.          │ │ │ │ │ │ │ └──── left CTRL key depressed
  1723.          │ │ │ │ │ │ └───── left ALT key depressed
  1724.          │ │ │ │ │ └────── system key depressed and held
  1725.          │ │ │ │ └─────── suspend key has been toggled
  1726.          │ │ │ └──────── scroll lock key is depressed
  1727.          │ │ └───────── num-lock key is depressed
  1728.          │ └────────── caps-lock key is depressed
  1729.          └─────────── insert key is depressed
  1730.  
  1731. ^Keyboard Flags Bytes 2 and 3
  1732.  
  1733.         │7│6│5│4│3│2│1│0│  40:97  LED Indicator Flags
  1734.          │ │ │ │ │ │ │ └──── scroll lock indicator
  1735.          │ │ │ │ │ │ └───── num-lock indicator
  1736.          │ │ │ │ │ └────── caps-lock indicator
  1737.          │ │ │ │ └─────── circus system indicator
  1738.          │ │ │ └──────── ACK received
  1739.          │ │ └───────── re-send received flag
  1740.          │ └────────── mode indicator update
  1741.          └─────────── keyboard transmit error flag
  1742.  
  1743.         │7│6│5│4│3│2│1│0│  40:96  Keyboard Mode/Type
  1744.          │ │ │ │ │ │ │ └──── last code was the E1 hidden code
  1745.          │ │ │ │ │ │ └───── last code was the E0 hidden code
  1746.          │ │ │ │ │ └────── right CTRL key depressed
  1747.          │ │ │ │ └─────── right ALT key depressed
  1748.          │ │ │ └──────── 101/102 enhanced keyboard installed
  1749.          │ │ └───────── force num-lock if Rd ID & KBX
  1750.          │ └────────── last char was first ID char
  1751.          └─────────── read ID in process
  1752.  
  1753.     - see    ~INT 9~  ~BDA~
  1754. :make codes:break codes
  1755. ^INT 9 - Hardware Keyboard Make/Break Codes
  1756.  
  1757. %    Key         Make  Break        Key    Make  Break
  1758.  
  1759.     Backspace     0E    8E            F1    3B    BB
  1760.     Caps Lock     3A    BA            F2    3C    BC
  1761.     Enter          1C    9C            F3    3D    BD
  1762.     Esc          01    81            F4    3E    BE
  1763.     Left Alt      38    B8            F7    41    C1
  1764.     Left Ctrl     1D    9D            F5    3F    BF
  1765.     Left Shift    2A    AA            F6    40    C0
  1766.     Num Lock      45    C5            F8    42    C2
  1767.     Right Shift   36    B6            F9    43    C3
  1768.     Scroll Lock   46    C6            F10    44    C4
  1769.     Space          39    B9            F11    57    D7
  1770.     Sys Req (AT)  54    D4            F12    58    D8
  1771.     Tab          0F    8F
  1772.  
  1773. %            Keypad Keys               Make   Break
  1774.  
  1775.             Keypad 0  (Ins)        52    D2
  1776.             Keypad 1  (End)         4F    CF
  1777.             Keypad 2  (Down arrow)    50    D0
  1778.             Keypad 3  (PgDn)        51    D1
  1779.             Keypad 4  (Left arrow)    4B    CB
  1780.             Keypad 5            4C    CC
  1781.             Keypad 6  (Right arrow)    4D    CD
  1782.             Keypad 7  (Home)        47    C7
  1783.             Keypad 8  (Up arrow)    48    C8
  1784.             Keypad 9  (PgUp)        49    C9
  1785.             Keypad .  (Del)         53    D3
  1786.             Keypad *  (PrtSc)        37    B7
  1787.             Keypad -            4A    CA
  1788.             Keypad +            4E    CE
  1789.  
  1790. %           Key    Make  Break           Key    Make  Break
  1791.  
  1792.         A      1E    9E         N      31    B1
  1793.         B      30    B0         O      18    98
  1794.         C      2E    AE         P      19    99
  1795.         D      20    A0         Q      10    90
  1796.         E      12    92         R      13    93
  1797.         F      21    A1         S      1F    9F
  1798.         G      22    A2         T      14    94
  1799.         H      23    A3         U      16    96
  1800.         I      17    97         V      2F    AF
  1801.         J      24    A4         W      11    91
  1802.         K      25    A5         X      2D    AD
  1803.         L      26    A6         Y      15    95
  1804.         M      32    B2         Z      2C    AC
  1805.  
  1806. %           Key    Make  Break           Key    Make  Break
  1807.  
  1808.         1      02    82         -      0C    8C
  1809.         2      03    83         =      0D    8D
  1810.         3      04    84         [      1A    9A
  1811.         4      05    85         ]      1B    9B
  1812.         5      06    86         ;      27    A7
  1813.         6      07    87         '      28    A8
  1814.         7      08    88         `      29    A9
  1815.         8      09    89         \      2B    AB
  1816.         9      0A    8A         ,      33    B3
  1817.         0      0B    8B         .      34    B4
  1818.                         /      35    B5
  1819.  
  1820. ^Enhanced Keyboard Keys (101/102 keys)
  1821.  
  1822. %    Control Keys          Make          Break
  1823.  
  1824.     Alt-PrtSc (SysReq)      54          D4
  1825.     Ctrl-PrtSc          E0 37       E0 B7
  1826.     Enter              E0 1C       E0 9C
  1827.     PrtSc              E0 2A E0 37      E0 B7 E0 AA
  1828.     Right Alt          E0 38       E0 B8
  1829.     Right Ctrl          E0 1D       E0 9D
  1830.     Shift-PrtSc          E0 37       E0 B7
  1831.     /              E0 35       E0 B5
  1832.     Pause              E1 1D 45 E1 9D C5  (not typematic)
  1833.     Ctrl-Pause (Ctrl-Break)   E0 46 E0 C6         (not typematic)
  1834.  
  1835.     - Keys marked as "not typematic" generate one stream of bytes
  1836.       without corresponding break scan code bytes (actually the
  1837.       break codes are part of the make code).
  1838.  
  1839.  
  1840. %            Normal Mode or
  1841. %            Shift w/Numlock
  1842. %    Key         Make     Break       ┌───── Numlock on ──────┐
  1843. %                          Make        Break
  1844.     Del         E0 53     E0 D3       E0 2A E0 53     E0 D3 E0 AA
  1845.     Down arrow     E0 50     E0 D0       E0 2A E0 50     E0 D0 E0 AA
  1846.     End         E0 4F     E0 CF       E0 2A E0 4F     E0 CF E0 AA
  1847.     Home         E0 47     E0 C7       E0 2A E0 47     E0 C7 E0 AA
  1848.     Ins         E0 52     E0 D2       E0 2A E0 52     E0 D2 E0 AA
  1849.     Left arrow     E0 4B     E0 CB       E0 2A E0 4B     E0 CB E0 AA
  1850.     PgDn         E0 51     E0 D1       E0 2A E0 51     E0 D1 E0 AA
  1851.     PgUp         E0 49     E0 C9       E0 2A E0 49     E0 C9 E0 AA
  1852.     Right arrow     E0 4D     E0 CD       E0 2A E0 4D     E0 CD E0 AA
  1853.     Up arrow     E0 48     E0 C8       E0 2A E0 48     E0 C8 E0 AA
  1854.  
  1855. %    Key          ┌──Left Shift Pressed──┐      ┌──Right Shift Pressed──┐
  1856. %             Make           Break          Make        Break
  1857.     Del          E0 AA E0 53   E0 D3 E0 2A    E0 B6 E0 53     E0 D3 E0 36
  1858.     Down arrow    E0 AA E0 50   E0 D0 E0 2A    E0 B6 E0 50     E0 D0 E0 36
  1859.     End          E0 AA E0 4F   E0 CF E0 2A    E0 B6 E0 4F     E0 CF E0 36
  1860.     Home          E0 AA E0 47   E0 C7 E0 2A    E0 B6 E0 47     E0 C7 E0 36
  1861.     Ins          E0 AA E0 52   E0 D2 E0 2A    E0 B6 E0 52     E0 D2 E0 36
  1862.     Left arrow    E0 AA E0 4B   E0 CB E0 2A    E0 B6 E0 4B     E0 CB E0 36
  1863.     PgDn          E0 AA E0 51   E0 D1 E0 2A    E0 B6 E0 51     E0 D1 E0 36
  1864.     PgUp          E0 AA E0 49   E0 C9 E0 2A    E0 B6 E0 49     E0 C9 E0 36
  1865.     Right arrow   E0 AA E0 4D   E0 CD E0 2A    E0 B6 E0 4D     E0 CD E0 36
  1866.     Up arrow      E0 AA E0 48   E0 C8 E0 2A    E0 B6 E0 48     E0 C8 E0 36
  1867.     /          E0 AA E0 35   E0 B5 E0 2A    E0 B6 E0 35     E0 B5 E0 36
  1868.  
  1869.  
  1870.     - The PS/2 models have three make/break scan code sets.  The first
  1871.       set matches the PC & XT make/break scan code set and is the one
  1872.       listed here.    Scan code sets are selected by writing the value F0
  1873.       to the keyboard via the ~8042~ (port 60h).  The following is a brief
  1874.       description of the scan code sets (see the PS/2 Technical Reference
  1875.       manuals for more information on scan code sets 2 and 3):
  1876.  
  1877.     ∙  set 1, each key has a base scan code.  Some keys generate
  1878.        extra scan codes to generate artificial shift states.  This
  1879.        is similar to the standard scan code set used on the PC and XT.
  1880.     ∙  set 2, each key sends one make scan code and two break scan
  1881.        codes bytes (F0 followed by the make code).    This scan code
  1882.        set is available on the IBM AT also.
  1883.     ∙  set 3, each key sends one make scan code and two break scan
  1884.        codes bytes (F0 followed by the make code) and no keys are
  1885.        altered by Shift/Alt/Ctrl keys.
  1886.     ∙  typematic scan codes are the same as the make scan code
  1887.  
  1888.     - Some Tandy 1000's do not handle Alt key combinations when multiple
  1889.       shift keys are pressed.  The Alt-Shift-H combination loses the Alt.
  1890.     - extended keys like (F11, F12) can only be read with systems that
  1891.       have extended keyboard BIOS support (or ~INT 9~ extensions);  to
  1892.       read these special keys on these systems ~INT 16,10~ must be used
  1893.  
  1894.       - see  ~SCAN CODES~   ~KB FLAGS~  ~KEYBOARD COMMANDS~
  1895. :GDT:Global Descriptor Table
  1896. ^GDT - Global Descriptor Table
  1897.  
  1898. %     Offset Size        Description
  1899.  
  1900.     00  8bytes    dummy, set to 0
  1901.     08  8bytes    ~GDT~ data segment location, set to 0
  1902.     10  8bytes    source GDT pointer
  1903.     18  8bytes    target GDT pointer
  1904.     20  8bytes    pointer to BIOS code segment, set to 0.    used by
  1905.             the BIOS to create protected mode code segment
  1906.     28  8bytes    pointer to BIOS stack segment, set to 0.  Used by
  1907.             the BIOS to create protected mode stack segment
  1908.     30  8bytes    user code segment
  1909.     38  8bytes    temporary BIOS code segment
  1910.  
  1911.  
  1912. %    Source/Target GDT use the following format (offsets 10h and 18h):
  1913.  
  1914. %     Offset Size        Description
  1915.  
  1916.     00   word    Segment limit
  1917.     02  3bytes    24 bit segment physical address
  1918.     05   byte    data access rights, set to 93h
  1919.     06   word    reserved word, must be 0
  1920.  
  1921.     - see    ~LGDT~  ~SGDT~
  1922.  
  1923. :media descriptor byte
  1924. ^Media Descriptor Byte
  1925.  
  1926. %    Media Descriptor Byte Layout:
  1927.  
  1928.     │7│6│5│4│3│2│1│0│ IBM Media Descriptor Byte
  1929.      │ │ │ │ │ │ │ └─── 1 = 2 sided, 0 = not 2 sided
  1930.      │ │ │ │ │ │ └──── 1 = 8 sector, 0 = not 8 sector
  1931.      │ │ │ │ │ └───── 1 = removable, 0 = not removable
  1932.      └─┴─┴─┴─┴────── must be set to 1
  1933.  
  1934.     F8    Hard disk
  1935.         Double sided  18 sector diskette  PS/2 1.44 Mb. DSQD
  1936.  
  1937.     F9    5¼  Double sided, High Density diskette (15 sector)
  1938.         3½  Double Sided, Double High Density diskette (9 sector)
  1939.  
  1940.     FA    Ram disk (not all Ramdisks use this)
  1941.  
  1942.     FC    5¼ Single Sided, Double Density diskette (9 sector)
  1943.         8  inch Double Sided, Single Density diskette
  1944.  
  1945.     FD    5¼ Double Sided, Double Density (9 sector)
  1946.         8  inch Double Sided Single Density (26 sector) (IBM 3740
  1947.            format) 128 bytes per sector, soft sector, 4 sectors
  1948.            cluster, 4 reserved sectors, 2 FATs, 68 directory entries,
  1949.            77*26*2 sectors.
  1950.  
  1951.     FE    5¼ Single Sided, Double Density diskette (8 sector)
  1952.         8  inch Single Sided, Single Density diskette (26 sector)
  1953.            (IBM 3740 format) 128 bytes per sector, soft sector,
  1954.            4 sectors per cluster, 1 reserved sector, 2 FATs. 68
  1955.            directory entries, 77*26 sectors.
  1956.         8  inch Double Sided, Double Density (8 sector), 1024 bytes
  1957.            per sector, soft sector, 1 sector per cluster, 1 reserved
  1958.            sector, 2 FATs, 192 directory entries, 77*8*2 sectors. To
  1959.            distinguish from 8 inch SS/SD attempt read of side 2.
  1960.  
  1961.     FF    5¼ Double Sided, Double Density diskette (8 sector)
  1962.  
  1963.     - see also   ~INT 21,1B~  ~INT 21,1C~  ~FAT~
  1964. :Memory Control Block:MCB
  1965. ^MCB - DOS Memory Control Block Format
  1966.  
  1967. %     Offset Size        Description
  1968.  
  1969.     00   byte    'M' 4Dh  member of a MCB chain, (not last)
  1970.             'Z' 5Ah  indicates last entry in MCB chain
  1971.             other values cause "Memory Allocation Failure" on exit
  1972.     01   word    ~PSP~ segment address of MCB owner (Process Id)
  1973.             possible values:
  1974.                 0 = free
  1975.                 8 = Allocated by DOS before first user pgm loaded
  1976.                 other = Process Id/PSP segment address of owner
  1977.     03   word    number of paras related to this MCB (excluding MCB)
  1978.     05 11bytes    reserved
  1979.     08  8bytes    ASCII program name, NULL terminated if less than max
  1980.             length (DOS 4.x+)
  1981.     10  nbytes    first byte of actual allocated memory block
  1982.  
  1983.  
  1984.     - to find the first MCB in the chain, use  ~INT 21,52~
  1985.     - DOS 3.1+ the first memory block contains the DOS data segment
  1986.       ie., installable drivers, buffers, etc
  1987.     - DOS 4.x the first memory block is divided into subsegments,
  1988.       with their own memory control blocks; offset 0000h is the first
  1989.     - the 'M' and 'Z' are said to represent Mark Zbikowski
  1990.     - the MCB chain is often referred to as a linked list, but
  1991.       technically isn't
  1992.  
  1993.  
  1994. ^DOS 4.x Initial Data Segment Subsegment Control Blocks:
  1995.  
  1996. %     Offset Size      Description
  1997.     00   byte    subsegment type
  1998.             'D'  device driver
  1999.             'E'  device driver appendage
  2000.             'I'  Installable File System driver
  2001.             'F'  FILES= control block storage area (for FILES>5)
  2002.             'X'  FCBS= control block storage area, if present
  2003.             'C'  BUFFERS EMS workspace area if BUFFERS /X is used
  2004.             'B'  BUFFERS= storage area
  2005.             'L'  LASTDRIVE= current directory structure array
  2006.             'S'  STACKS= code/data area, if present (see below)
  2007.     01   word    paragraph of subsegment start
  2008.     03   word    subsegment size in paragraphs
  2009.     05  3bytes    unused
  2010.     08        types "D" and "I", filename of driver loaded driver
  2011.  
  2012.  
  2013.     - see  ~INT 21,48~  ~INT 21,49~  ~INT 21,4A~
  2014.  
  2015. :Program Segment Prefix:PSP
  2016. ^PSP - DOS Program Segment Prefix Layout
  2017.  
  2018. %     Offset Size          Description
  2019.  
  2020.     00   word    machine code ~INT 20~ instruction (CDh 20h)
  2021.     02   word    top of memory in segment (paragraph) form
  2022.     04   byte    reserved for DOS, usually 0
  2023.     05  5bytes    machine code instruction long call to the DOS
  2024.             function dispatcher (obsolete CP/M)
  2025.     06   word    .COM programs bytes available in segment (CP/M)
  2026.     0A   dword    ~INT 22~ terminate address;  DOS loader jumps to this
  2027.             address upon exit;  the EXEC function forces a child
  2028.             process to return to the parent by setting this
  2029.             vector to code within the parent (IP,CS)
  2030.     0E   dword    ~INT 23~ Ctrl-Break exit address; the original INT 23
  2031.             vector is NOT restored from this pointer (IP,CS)
  2032.     12   dword    ~INT 24~ critical error exit address; the original
  2033.             INT 24 vector is NOT restored from this field (IP,CS)
  2034.     16   word    parent process segment addr (Undoc. DOS 2.x+)
  2035.             COMMAND.COM has a parent id of zero, or its own PSP
  2036.     18  20bytes    file handle array (Undocumented DOS 2.x+); if handle
  2037.             array element is FF then handle is available.  Network
  2038.             redirectors often indicate remotes files by setting
  2039.             these to values between 80-FE.
  2040.     2C   word    segment address of the environment, or zero (DOS 2.x+)
  2041.     2E   dword    SS:SP on entry to last INT 21 function (Undoc. 2.x+) ╪
  2042.     32   word    handle array size (Undocumented DOS 3.x+)
  2043.     34   dword    handle array pointer (Undocumented DOS 3.x+)
  2044.     38   dword    pointer to previous PSP (deflt FFFF:FFFF, Undoc 3.x+) ╪
  2045.     3C  20bytes    unused in DOS before 4.01  ╪
  2046.     50   3bytes    DOS function dispatcher CDh 21h CBh (Undoc. 3.x+) ╪
  2047.     53   9bytes    unused
  2048.     5C  36bytes    default unopened ~FCB~ #1 (parts overlayed by FCB #2)
  2049.     6C  20bytes    default unopened FCB #2 (overlays part of FCB #1)
  2050.     80   byte    count of characters in command tail;  all bytes
  2051.             following command name;  also default ~DTA~ (128 bytes)
  2052.     81 127bytes    all characters entered after the program name followed
  2053.             by a CR byte
  2054.  
  2055.  
  2056.  
  2057.     - offset 5 contains a jump address which is 2 bytes too low for
  2058.       PSP's created by the DOS EXEC function in DOS 2.x+  ╪
  2059.     - program name and complete path can be found after the environment
  2060.       in DOS versions after 3.0.  See offset 2Ch.
  2061.  
  2062.     ╪ see ~Bibliography~ for reference to "Undocumented DOS"
  2063. :scan codes
  2064. ^INT 16 - Keyboard Scan Codes
  2065.  
  2066. %           Key     Normal    Shifted   w/Ctrl    w/Alt
  2067.  
  2068.         A      1E61        1E41      1E01    1E00
  2069.         B      3062        3042      3002    3000
  2070.         C      2E63        2E42      2E03    2E00
  2071.         D      2064        2044      2004    2000
  2072.         E      1265        1245      1205    1200
  2073.         F      2166        2146      2106    2100
  2074.         G      2267        2247      2207    2200
  2075.         H      2368        2348      2308    2300
  2076.         I      1769        1749      1709    1700
  2077.         J      246A        244A      240A    2400
  2078.         K      256B        254B      250B    2500
  2079.         L      266C        264C      260C    2600
  2080.         M      326D        324D      320D    3200
  2081.         N      316E        314E      310E    3100
  2082.         O      186F        184F      180F    1800
  2083.         P      1970        1950      1910    1900
  2084.         Q      1071        1051      1011    1000
  2085.         R      1372        1352      1312    1300
  2086.         S      1F73        1F53      1F13    1F00
  2087.         T      1474        1454      1414    1400
  2088.         U      1675        1655      1615    1600
  2089.         V      2F76        2F56      2F16    2F00
  2090.         W      1177        1157      1117    1100
  2091.         X      2D78        2D58      2D18    2D00
  2092.         Y      1579        1559      1519    1500
  2093.         Z      2C7A        2C5A      2C1A    2C00
  2094.     
  2095. %           Key     Normal    Shifted   w/Ctrl    w/Alt
  2096.  
  2097.         1      0231        0221        7800
  2098.         2      0332        0340      0300    7900
  2099.         3      0433        0423        7A00
  2100.         4      0534        0524        7B00
  2101.         5      0635        0625        7C00
  2102.         6      0736        075E      071E    7D00
  2103.         7      0837        0826        7E00
  2104.         8      0938        092A        7F00
  2105.         9      0A39        0A28        8000
  2106.         0      0B30        0B29        8100
  2107.  
  2108. %           Key     Normal    Shifted   w/Ctrl    w/Alt
  2109.  
  2110.         -      0C2D        0C5F      0C1F    8200
  2111.         =      0D3D        0D2B        8300
  2112.         [      1A5B        1A7B      1A1B    1A00
  2113.         ]      1B5D        1B7D      1B1D    1B00
  2114.         ;      273B        273A        2700
  2115.         '      2827        2822
  2116.         `      2960        297E
  2117.         \      2B5C        2B7C      2B1C    2600 (same as Alt L)
  2118.         ,      332C        333C
  2119.         .      342E        343E
  2120.         /      352F        353F
  2121.  
  2122. %        Key     Normal    Shifted   w/Ctrl    w/Alt
  2123.  
  2124.         F1      3B00        5400      5E00    6800
  2125.         F2      3C00        5500      5F00    6900
  2126.         F3      3D00        5600      6000    6A00
  2127.         F4      3E00        5700      6100    6B00
  2128.         F5      3F00        5800      6200    6C00
  2129.         F6      4000        5900      6300    6D00
  2130.         F7      4100        5A00      6400    6E00
  2131.         F8      4200        5B00      6500    6F00
  2132.         F9      4300        5C00      6600    7000
  2133.         F10      4400        5D00      6700    7100
  2134.         F11      8500        8700      8900    8B00
  2135.         F12      8600        8800      8A00    8C00
  2136.  
  2137. %        Key        Normal    Shifted    w/Ctrl      w/Alt
  2138.  
  2139.         BackSpace    0E08      0E08     0E7F      0E00
  2140.         Del         5300      532E     9300      A300
  2141.         Down Arrow   5000      5032     9100      A000
  2142.         End         4F00      4F31     7500      9F00
  2143.         Enter         1C0D      1C0D     1C0A      A600
  2144.         Esc         011B      011B     011B      0100
  2145.         Home         4700      4737     7700      9700
  2146.         Ins         5200      5230     9200      A200
  2147.         Keypad 5        4C35     8F00
  2148.         Keypad *     372A         9600      3700
  2149.         Keypad -     4A2D      4A2D     8E00      4A00
  2150.         Keypad +     4E2B      4E2B          4E00
  2151.         Keypad /     352F      352F     9500      A400
  2152.         Left Arrow   4B00      4B34     7300      9B00
  2153.         PgDn         5100      5133     7600      A100
  2154.         PgUp         4900      4939     8400      9900
  2155.         PrtSc                 7200
  2156.         Right Arrow  4D00      4D36     7400      9D00
  2157.         SpaceBar     3920      3920     3920      3920
  2158.         Tab         0F09      0F00     9400      A500
  2159.         Up Arrow     4800      4838     8D00      9800
  2160.  
  2161.  
  2162.     - Some key combinations are not available on all systems.  The PS/2
  2163.       includes many that aren't available on the PC, XT and AT.
  2164.     - To retrieve the character from a scan code logical AND the word
  2165.       with 0x00FF.
  2166.     - see  ~INT 16~  ~MAKE CODES~
  2167. :SFT:file table:System File Table
  2168. ^System File Table  (Undocumented)
  2169.  
  2170. ^DOS 2.x System File Table Format
  2171.  
  2172. %     Offset Size        Description
  2173.  
  2174.     00   dword    pointer to next system file table; offset of ffffh
  2175.             indicates last table in chain
  2176.     04   word    number of file descriptors in table
  2177.     06  nbytes    file descriptor table of the format (40 bytes each):
  2178.  
  2179. %     Offset Size        Description
  2180.  
  2181.     00   byte    count of handles referring to this file or
  2182.             zero if file is no longer open
  2183.     01   byte    open mode
  2184.     02   byte    file attribute
  2185.     03   byte    drive (1=A, 2=B:, ..., 0=char device)
  2186.     04 11bytes    filename in ~FCB~ format
  2187.     0F   word    unknown
  2188.     11   word    unknown
  2189.     13   dword    file size
  2190.     17   word    file date
  2191.     19   word    file time
  2192.     1B   byte    device attribute
  2193.     1C   word    starting cluster of file (block device)
  2194.          dword    pointer to device driver (if char device)
  2195.     1E   word    if block device, relative cluster within file of
  2196.             the last cluster read; zero if file has never
  2197.             been read or written
  2198.     20   word    absolute cluster number of current cluster
  2199.     22   word    unknown
  2200.     24   dword    current file position
  2201.  
  2202.  
  2203. ^DOS 3.x System File Table and FCB Table Format
  2204.  
  2205. %     Offset Size        Description
  2206.  
  2207.     00   dword    pointer to next system file table; offset of ffffh
  2208.             indicates last table in chain
  2209.     04   word    number of file descriptors in table
  2210.     06  nbytes    file descriptor table of the format (53 bytes each):
  2211.  
  2212. %     Offset Size        Description
  2213.  
  2214.     00   word      count of handles referring to this file or
  2215.             zero if file is no longer open
  2216.     02   word    open mode, bit 15 set if file id opened via FCB
  2217.     04   byte    file attribute
  2218.     05   word    device info word
  2219.     07   dword    if char device pointer to device driver header
  2220.             if block device pointer to DOS Device Control Block
  2221.     0B   word    starting cluster of file
  2222.     0D   word    file time
  2223.     0F   word    file date
  2224.     11   dword    file size
  2225.     15   dword    current file position
  2226.     19   word    if block device, relative cluster within file of
  2227.             the last cluster read
  2228.     1B   word    absolute cluster number of last cluster read
  2229.             zero if file has never been read or written
  2230.     1D   word    sector number containing the directory entry
  2231.     1F   byte    number of dir entry within sector
  2232.     20 11bytes    filename in ~FCB~ format
  2233.     2B   dword    SHARE pointer to previous ~SFT~ sharing same file
  2234.     2F   word    SHARE number of network machine opening file
  2235.     31   word    PSP segment of file owner
  2236.     33   word    offset within SHARE code segment of sharing record
  2237.             0000h = none
  2238.  
  2239.  
  2240. ^DOS 4.0+ System File Table and FCB Table
  2241.  
  2242. %     Offset Size        Description
  2243.  
  2244.     00   dword    pointer to next system file table; offset of ffffh
  2245.             indicates last table in chain
  2246.     04   word    number of file descriptors in table
  2247.     06  nbytes    file descriptor table of the format (59 bytes each):
  2248.  
  2249. %     Offset Size        Description
  2250.  
  2251.     00   word       count of handles referring to this file or
  2252.             zero if file is no longer open
  2253.     02   word    open mode, bit 15 set if file id opened via FCB
  2254.     04   byte    file attribute
  2255.     05   word    device info word
  2256.     07   dword    if char device pointer to device driver header
  2257.             if block device pointer to DOS Device Control Block
  2258.             or REDIR data
  2259.     0B   word    starting cluster of file
  2260.     0D   word    file time
  2261.     0F   word    file date
  2262.     11   dword    file size
  2263.     15   dword    current file position
  2264.     19   dword    if network redirector, pointer to REDIRIFS record
  2265.          word    if local block dev, relative cluster within file
  2266.             of the last cluster read
  2267.     1B   dword    if local, sector number of directory entry
  2268.     1F   byte    if local, number of directory entry within sector
  2269.     20  11bytes    filename in ~FCB~ format
  2270.     2B   dword    SHARE pointer to previous ~SFT~ sharing same file
  2271.     2F   word    SHARE number of network machine opening file
  2272.     31   word    PSP segment of file owner
  2273.     33   word    offset within SHARE code seg of sharing record
  2274.             0000h = none
  2275.     35   word    absolute cluster number of last cluster read
  2276.             zero if file has never been read or written
  2277.     37   dword    pointer to file IFS driver, NULL if native DOS
  2278.  
  2279.  
  2280.     - these structures are allocated by DOS during the scanning of the
  2281.       CONFIG.SYS file
  2282.     - ~INT 21,67~ can be used to allow an application to have more than
  2283.       20 file handles;  the total number of handles is limited still to
  2284.       the value of FILES=n in CONFIG.SYS
  2285.     - the structure of these fields is undocumented;  I do not recommend
  2286.       relying on any of this information, instead use it as an aid in
  2287.       debugging
  2288.     - see ~Bibliography~ references to Bernd Schemmer and "Data Structures
  2289.       Used in IBM PC Compatibles and the PS/2".
  2290.     - see    ~INT 21,52~
  2291.  
  2292. :system descriptor
  2293. ^BIOS System Descriptor Table  (PS/2)
  2294.  
  2295. %     Offset Size         Description
  2296.  
  2297.     00   word    length of descriptor (8 minimum)
  2298.     02   byte    model byte (same as FFFF:E, not reliable)
  2299.     03   byte    secondary model byte
  2300.     04   byte    BIOS revision level (zero based)
  2301.     05   byte    feature information  (see table)
  2302.     06  dword    reserved
  2303.  
  2304.  
  2305.     │7│6│5│4│3│2│1│0│ feature information at offset 5
  2306.      │ │ │ │ │ │ │ └─── reserved
  2307.      │ │ │ │ │ │ └──── 0=PC bus, 1=Micro Channel
  2308.      │ │ │ │ │ └───── Extended BIOS Data Area (~EBDA~) allocated
  2309.      │ │ │ │ └────── wait for external event supported
  2310.      │ │ │ └─────── ~INT 15,4F~ used (kbd intercept)
  2311.      │ │ └──────── RTC present
  2312.      │ └───────── 2nd ~8259~ present
  2313.      └────────── DMA channel 3 used by fixed disk BIOS
  2314.  
  2315.  
  2316.     - see also  ~MACHINE IDENT~  and  ~INT 15,C0~
  2317.  
  2318. :video information:video tables
  2319. ^Video Information Tables
  2320.  
  2321. %    BIOS Data Area Fields
  2322.  
  2323. %      Address    Size        Description
  2324.  
  2325.     40:49    byte    Current video mode  (see ~VIDEO MODE~)
  2326.     40:4A    word    Number of screen columns
  2327.     40:4C    word    Size of video regen buffer in bytes
  2328.     40:4E    word    Starting address in video regen buffer (offset)
  2329.     40:50  8 words    Cursor position of pages 1-8, high order
  2330.             byte=row, low order byte=column
  2331.     40:60    byte    Ending (bottom) scan line for cursor
  2332.     40:61    byte    Starting (top) scan line for cursor
  2333.     40:62    byte    Active display page number
  2334.     40:63    word    Base port address for active ~6845~ CRT controller
  2335.             3B4h = mono, 3D4h = color
  2336.     40:65    byte    6845 CRT mode control register value (port 3x8h)
  2337.             EGA/VGA values emulate those of the MDA/CGA
  2338.     40:66    byte    CGA current color palette setting (port 3d9h)
  2339.             EGA and VGA values emulate the CGA
  2340.     40:84    byte    Rows on the screen (less 1, EGA+)
  2341.     40:85    word    Point height of character matrix (EGA+)
  2342.     40:87    byte    Video mode options (EGA+)
  2343.  
  2344.         │7│6│5│4│3│2│1│0│ Video mode options (EGA+)
  2345.          │ │ │ │ │ │ │ └── 1=alphanumeric cursor emulation enabled
  2346.          │ │ │ │ │ │ └─── 1=video subsystem attached to monochrome
  2347.          │ │ │ │ │ └──── reserved
  2348.          │ │ │ │ └───── 1=video subsystem is inactive
  2349.          │ │ │ └────── reserved
  2350.          │ └─┴─────── video RAM  00-64K  10-192K  01-128K  11-256K
  2351.          └────────── video mode number passed to ~INT 10~, function 0
  2352.  
  2353.     40:88    byte    EGA feature bit switches, emulated on VGA
  2354.  
  2355.         │7│6│5│4│3│2│1│0│ EGA feature bit switches (EGA+)
  2356.          │ │ │ │ │ │ │ └── EGA SW1 config (1=off)
  2357.          │ │ │ │ │ │ └─── EGA SW2 config (1=off)
  2358.          │ │ │ │ │ └──── EGA SW3 config (1=off)
  2359.          │ │ │ │ └───── EGA SW4 config (1=off)
  2360.          │ │ │ └────── Input FEAT0 (ISR0 bit 5) after output on FCR0
  2361.          │ │ └─────── Input FEAT0 (ISR0 bit 6) after output on FCR0
  2362.          │ └──────── Input FEAT1 (ISR0 bit 5) after output on FCR1
  2363.          └───────── Input FEAT1 (ISR0 bit 6) after output on FCR1
  2364.  
  2365.     40:89    byte    Video display data area (MCGA and VGA)
  2366.  
  2367.         │7│6│5│4│3│2│1│0│ Video display data area (MCGA and VGA)
  2368.          │ │ │ │ │ │ │ └── 1=VGA is active
  2369.          │ │ │ │ │ │ └─── 1=gray scale is enabled
  2370.          │ │ │ │ │ └──── 1=using monochrome monitor
  2371.          │ │ │ │ └───── 1=default palette loading is disabled
  2372.          │ │ │ └────── see table below
  2373.          │ │ └─────── reserved
  2374.          │ └────────  1=display switching enabled
  2375.          └───────── alphanumeric scan lines (see table below)
  2376.  
  2377. %        Bit7   Bit4    Scan Line information
  2378.          0    0    350 line mode
  2379.          0    1    400 line mode
  2380.          1    0    200 line mode
  2381.          1    1    reserved
  2382.  
  2383.     40:8A    byte    Display Combination Code (DCC) table index (EGA+)
  2384.     40:A8  dword    BIOS Video Save/Override Pointer Table address
  2385.  
  2386.  
  2387. ^EGA / VGA Related Tables
  2388.  
  2389. %    Video Save/Override Pointer Table (pointer at 40:A8):
  2390.  
  2391.     00  dword  Video Parameter Table pointer
  2392.     04  dword  Dynamic Parameter Save Area pointer (EGA, VGA)
  2393.     08  dword  Alphanumeric Character Set Override pointer
  2394.     0C  dword  Graphics Character Set Override pointer
  2395.     10  dword  Secondary Save Pointer Table pointer (VGA)
  2396.     14  dword  reserved, set to 0000:0000
  2397.     18  dword  reserved, set to 0000:0000
  2398.  
  2399.  
  2400. %    Video Parameter Table
  2401.  
  2402.     00   byte    number of displayed character columns
  2403.     01   byte    number of displayed screen rows minus 1
  2404.     02   byte    character matrix height in points
  2405.     03   word    video buffer size in bytes
  2406.     05   dword   contents of sequencer registers 1-4
  2407.     09   byte    misc. output register values
  2408.     0A  25bytes  contents of CRTC registers 0-18h
  2409.     23  20bytes  contents of attribute controller regs 0-13h
  2410.     37  9 bytes  contents of graphics controller regs 0-8
  2411.  
  2412.  
  2413. %    Dynamic Parameter Save Area
  2414.  
  2415.     00  16bytes   contents of graphics controller pallette regs
  2416.     10    byte    contents of graphics controller overscan reg
  2417.     11  239bytes  reserved
  2418.  
  2419.  
  2420. %    Alphanumeric Character Set Override
  2421.  
  2422.     00   byte    length of each character definition in bytes
  2423.     01   byte    character generator RAM bank
  2424.     02   word    count of characters defined
  2425.     04   word    first character code in table
  2426.     06   dword   pointer to character font definition table
  2427.     0A   byte    number of character rows displayed
  2428.     0B   nbytes  array of applicable video modes
  2429.     0B+n byte    FFh end of mode list marker
  2430.  
  2431.  
  2432. %    Graphics Character Set Override
  2433.  
  2434.     00   byte    count of displayed character rows
  2435.     01   word    length of each character definition in bytes
  2436.     03   dword   pointer to character font definition table
  2437.     07   nbytes  array of applicable video modes
  2438.     07+n byte    FFh end of mode list marker
  2439.  
  2440.  
  2441. %    Secondary Save Pointer Table
  2442.  
  2443.     00  word   length of table in bytes
  2444.     02  dword  pointer to display combination code table
  2445.     06  dword  pointer to secondary alphanumeric char set override
  2446.     0A  dword  pointer to user palette profile table  (VGA)
  2447.     0E  dword  reserved
  2448.     12  dword  reserved
  2449.     16  dword  reserved
  2450.  
  2451.  
  2452. %    Display Combination Code Table
  2453.  
  2454.     00   byte   number of table entries
  2455.     01   byte   DCC table version number
  2456.     02   byte   maximum display type code
  2457.     03   byte   reserved
  2458.     04  n words array valid display combinations:
  2459.  
  2460.     0,0 entry  0  no display
  2461.     0,1 entry  1  MDPA
  2462.     0,2 entry  2  CGA
  2463.     2,1 entry  3  MDPA + CGA
  2464.     0,4 entry  4  EGA
  2465.     4,1 entry  5  EGA + MDPA
  2466.     0,5 entry  6  MEGA
  2467.     2,5 entry  7  MEGA + CGA
  2468.     0,6 entry  8  PGC
  2469.     1,6 entry  9  PGC + MDPA
  2470.     5,6 entry 10  PGC + MEGA
  2471.     0,8 entry 11  CVGA
  2472.     1,8 entry 12  CVGA + MDPA
  2473.     0,7 entry 13  MVGA
  2474.     2,7 entry 14  MVGA + CGA
  2475.     2,6 entry 15  MVGA + PGC
  2476.  
  2477.  
  2478. %    Secondary Alpha Mode Auxillary Character Generator Table
  2479.  
  2480.     00   byte    bytes per character
  2481.     01   byte    block to load
  2482.     02   byte    reserved
  2483.     03   dword   font table pointer
  2484.     07   nbytes  array of mode values for this font
  2485.     07+n byte    FFh end of mode list marker
  2486.  
  2487.  
  2488. %    Palette Profile Table (VGA only)
  2489.  
  2490.     00   byte    1 - enable underlining in all alphanumeric modes
  2491.              0 - enable underlining in monochrome alpha modes
  2492.             -1 - disable underlining in all alpha modes
  2493.     01   byte   reserved
  2494.     02   word   reserved
  2495.     04   word   count of attribute controller regs in table
  2496.     06   word   first attribute controller register number
  2497.     08   dword  pointer to attribute controller reg table
  2498.     0C   word   count of video DAC color registers in table
  2499.     0E   word   first video DAC color register number
  2500.     10   dword  video DAC color register table pointer
  2501.     14   nbytes array of applicable video modes for this font
  2502.     14+n byte   FFh end of video mode list marker
  2503.  
  2504.  
  2505.     - see also ~BIOS Data Area~
  2506.     - see ~INT 10,1B~ for Dynamic Video State Table and Video Static
  2507.       Functionality Table
  2508.  
  2509. :video pages
  2510. ^Video modes and corresponding number of pages
  2511.  
  2512.  
  2513. %          Mode      Pages        Adapters
  2514.  
  2515.         00     pages 0-7    (CGA,EGA,MCGA,VGA)
  2516.         01     pages 0-7    (CGA,EGA,MCGA,VGA)
  2517.         02     pages 0-3    (CGA)
  2518.             pages 0-7    (EGA,MCGA,VGA)
  2519.         03    pages 0-3    (CGA)
  2520.             pages 0-7    (EGA,MCGA,VGA)
  2521.         07    pages 0-7    (EGA,VGA)
  2522.             no pages    (MDA)
  2523.         0D    pages 0-7    (EGA,VGA)
  2524.         0E    pages 0-4    (EGA,VGA)
  2525.         0F    pages 0-1    (EGA,VGA)
  2526.         10    pages 0-1    (EGA,VGA)
  2527.  
  2528. :XFCB:Extended FCB:extended file ctlblk
  2529. ^XFCB - Extended DOS File Control Block
  2530.  
  2531. %     Offset Size        Description
  2532.  
  2533.     00   byte   flag containing FF if this is an extended ~FCB~
  2534.     01  5bytes  reserved
  2535.     06   byte   directory attribute byte    (see ~FILE ATTRIBUTE~)
  2536.     07   byte   drive number (0 for default drive, 1 = A:, 2 = B:)
  2537.     08  8bytes  filename, left justified with trailing blanks
  2538.     16  3bytes  filename extension, left justified w/blanks
  2539.     19   word   current block number relative to file start (0 based)
  2540.     21   word   logical record size in bytes
  2541.     23   dword  file size in bytes
  2542.     27   word   date the file was created or last updated:
  2543.  
  2544.         │F│E│D│C│B│A│9│8│7│6│5│4│3│2│1│0│ 21,20
  2545.          │ │ │ │ │ │ │ │ │ │ │ └─┴─┴─┴─┴─ day 1-31
  2546.          │ │ │ │ │ │ │ └─┴─┴─┴────────── month 1-12
  2547.          └─┴─┴─┴─┴─┴─┴───────────────── year + 1980
  2548.  
  2549.     29 16bytes  reserved for system use
  2550.     39   byte   relative record number within current BLOCK
  2551.     40  4bytes  relative record number from start of file (0 based)
  2552.  
  2553.